Skip to content

Commit ce8b8d7

Browse files
author
David Tesar
authored
Add IaC Pipelines microsoft#40
2 parents 79de271 + 23f17d8 commit ce8b8d7

File tree

3 files changed

+181
-0
lines changed

3 files changed

+181
-0
lines changed
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"baseName": {
6+
"type": "string",
7+
"maxLength": 10,
8+
"minLength": 3,
9+
"metadata": {
10+
"description": "The base name to use as prefix to create all the resources."
11+
}
12+
},
13+
"location": {
14+
"type": "string",
15+
"defaultValue": "eastus",
16+
"allowedValues": [
17+
"eastus",
18+
"eastus2",
19+
"southcentralus",
20+
"southeastasia",
21+
"westcentralus",
22+
"westeurope",
23+
"westus2"
24+
],
25+
"metadata": {
26+
"description": "Specifies the location for all resources."
27+
}
28+
}
29+
},
30+
"variables": {
31+
"amlWorkspaceName": "[concat(parameters('baseName'),'-AML-WS')]",
32+
"storageAccountName": "[concat(toLower(parameters('baseName')), 'amlsa')]",
33+
"storageAccountType": "Standard_LRS",
34+
"keyVaultName": "[concat(parameters('baseName'),'-AML-KV')]",
35+
"tenantId": "[subscription().tenantId]",
36+
"applicationInsightsName": "[concat(parameters('baseName'),'-AML-AI')]",
37+
"containerRegistryName": "[concat(toLower(parameters('baseName')),'amlcr')]"
38+
},
39+
"resources": [
40+
{
41+
"type": "Microsoft.Storage/storageAccounts",
42+
"apiVersion": "2018-07-01",
43+
"name": "[variables('storageAccountName')]",
44+
"location": "[parameters('location')]",
45+
"sku": {
46+
"name": "[variables('storageAccountType')]"
47+
},
48+
"kind": "StorageV2",
49+
"properties": {
50+
"encryption": {
51+
"services": {
52+
"blob": {
53+
"enabled": true
54+
},
55+
"file": {
56+
"enabled": true
57+
}
58+
},
59+
"keySource": "Microsoft.Storage"
60+
},
61+
"supportsHttpsTrafficOnly": true
62+
}
63+
},
64+
{
65+
"type": "Microsoft.KeyVault/vaults",
66+
"apiVersion": "2018-02-14",
67+
"name": "[variables('keyVaultName')]",
68+
"location": "[parameters('location')]",
69+
"properties": {
70+
"tenantId": "[variables('tenantId')]",
71+
"sku": {
72+
"name": "standard",
73+
"family": "A"
74+
},
75+
"accessPolicies": []
76+
}
77+
},
78+
{
79+
"type": "Microsoft.Insights/components",
80+
"apiVersion": "2015-05-01",
81+
"name": "[variables('applicationInsightsName')]",
82+
"location": "[if(or(equals(parameters('location'),'eastus2'),equals(parameters('location'),'westcentralus')),'southcentralus',parameters('location'))]",
83+
"kind": "web",
84+
"properties": {
85+
"Application_Type": "web"
86+
}
87+
},
88+
{
89+
"type": "Microsoft.ContainerRegistry/registries",
90+
"apiVersion": "2017-10-01",
91+
"name": "[variables('containerRegistryName')]",
92+
"location": "[parameters('location')]",
93+
"sku": {
94+
"name": "Standard"
95+
},
96+
"properties": {
97+
"adminUserEnabled": true
98+
}
99+
},
100+
{
101+
"type": "Microsoft.MachineLearningServices/workspaces",
102+
"apiVersion": "2018-11-19",
103+
"name": "[variables('amlWorkspaceName')]",
104+
"location": "[parameters('location')]",
105+
"dependsOn": [
106+
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
107+
"[resourceId('Microsoft.KeyVault/vaults', variables('keyVaultName'))]",
108+
"[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]",
109+
"[resourceId('Microsoft.ContainerRegistry/registries', variables('containerRegistryName'))]"
110+
],
111+
"identity": {
112+
"type": "systemAssigned"
113+
},
114+
"properties": {
115+
"friendlyName": "[variables('amlWorkspaceName')]",
116+
"keyVault": "[resourceId('Microsoft.KeyVault/vaults',variables('keyVaultName'))]",
117+
"applicationInsights": "[resourceId('Microsoft.Insights/components',variables('applicationInsightsName'))]",
118+
"containerRegistry": "[resourceId('Microsoft.ContainerRegistry/registries',variables('containerRegistryName'))]",
119+
"storageAccount": "[resourceId('Microsoft.Storage/storageAccounts/',variables('storageAccountName'))]"
120+
}
121+
}
122+
]
123+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
trigger:
2+
branches:
3+
include:
4+
- master
5+
paths:
6+
include:
7+
- environment_setup/arm-templates/*
8+
9+
pool:
10+
vmImage: 'ubuntu-latest'
11+
12+
variables:
13+
baseName: $[coalesce(variables['baseNameOverride'], 'mlops')]
14+
location: $[coalesce(variables['locationOverride'], 'centralus')]
15+
azuresub: $[coalesce(variables['azuresubOverride'], 'davete02_sub')]
16+
17+
18+
steps:
19+
- task: AzureResourceGroupDeployment@2
20+
inputs:
21+
azureSubscription: $(azuresub)
22+
action: 'Create Or Update Resource Group'
23+
resourceGroupName: '$(baseName)-AML-RG'
24+
location: $(location)
25+
templateLocation: 'Linked artifact'
26+
csmFile: '$(Build.SourcesDirectory)/environment_setup/arm-templates/cloud-environment.json'
27+
overrideParameters: '-baseName $(baseName)'
28+
deploymentMode: 'Incremental'
29+
displayName: 'Deploy MLOps resources to Azure'
30+
31+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
trigger:
2+
branches:
3+
include:
4+
- master
5+
paths:
6+
include:
7+
- environment_setup/arm-templates/*
8+
9+
pool:
10+
vmImage: 'ubuntu-latest'
11+
12+
variables:
13+
baseName: $[coalesce(variables['baseNameOverride'], 'mlops')]
14+
location: $[coalesce(variables['locationOverride'], 'centralus')]
15+
azuresub: $[coalesce(variables['azuresubOverride'], 'davete02_sub')]
16+
17+
18+
steps:
19+
- task: AzureResourceGroupDeployment@2
20+
inputs:
21+
azureSubscription: $(azuresub)
22+
action: 'DeleteRG'
23+
resourceGroupName: '$(baseName)-AML-RG'
24+
location: $(location)
25+
displayName: 'Delete resources in Azure'
26+
27+

0 commit comments

Comments
 (0)