Skip to content

Commit

Permalink
clean up and open script layout
Browse files Browse the repository at this point in the history
  • Loading branch information
hmeiland committed Feb 19, 2024
1 parent 5150c05 commit 53d408a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
13 changes: 8 additions & 5 deletions deploy/amlhpc_simple.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var containerRegistryId = registry.id
var subnetClusterId = subnetCluster.id

resource storageAccount 'Microsoft.Storage/storageAccounts@2022-05-01' = {
name: '${storageAccountName}'
name: storageAccountName
location: location
sku: {
name: 'Standard_RAGRS'
Expand All @@ -44,7 +44,7 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2022-05-01' = {
}

resource vault 'Microsoft.KeyVault/vaults@2022-07-01' = {
name: '${keyVaultName}'
name: keyVaultName
location: location
properties: {
tenantId: tenantId
Expand All @@ -70,7 +70,7 @@ resource registry 'Microsoft.ContainerRegistry/registries@2022-02-01-preview' =
sku: {
name: 'Standard'
}
name: '${containerRegistryName}'
name: containerRegistryName
location: location
properties: {
adminUserEnabled: false
Expand All @@ -81,7 +81,7 @@ resource workspace 'Microsoft.MachineLearningServices/workspaces@2023-06-01-prev
identity: {
type: 'SystemAssigned'
}
name: '${workspaceName}'
name: workspaceName
location: location
properties: {
friendlyName: workspaceName
Expand Down Expand Up @@ -147,7 +147,10 @@ resource amlLoginVM 'Microsoft.MachineLearningServices/workspaces/computes@2023-
scripts: {
creationScript: {
scriptSource : 'inline'
scriptData: base64('pip install amlhpc; echo "export SUBSCRIPTION=${subscription().subscriptionId}" > /etc/profile.d/amlhpc.sh;')
scriptData: base64('''
pip install amlhpc
echo "export SUBSCRIPTION=${subscription().subscriptionId}" > /etc/profile.d/amlhpc.sh
''')
}
startupScript: {
scriptSource : 'inline'
Expand Down
40 changes: 20 additions & 20 deletions deploy/amlhpc_simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "15479895345451507432"
"templateHash": "3905114379493833843"
}
},
"parameters": {
Expand All @@ -26,17 +26,17 @@
"containerRegistryName": "[substring(format('cr{0}{1}', parameters('name'), variables('resourcePostfix')), 0, 20)]",
"workspaceName": "[substring(format('ml{0}{1}', parameters('name'), variables('resourcePostfix')), 0, 20)]",
"virtualNetworkName": "[substring(format('vn{0}{1}', parameters('name'), variables('resourcePostfix')), 0, 20)]",
"storageAccountId": "[resourceId('Microsoft.Storage/storageAccounts', format('{0}', variables('storageAccountName')))]",
"keyVaultId": "[resourceId('Microsoft.KeyVault/vaults', format('{0}', variables('keyVaultName')))]",
"storageAccountId": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
"keyVaultId": "[resourceId('Microsoft.KeyVault/vaults', variables('keyVaultName'))]",
"applicationInsightId": "[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]",
"containerRegistryId": "[resourceId('Microsoft.ContainerRegistry/registries', format('{0}', variables('containerRegistryName')))]",
"containerRegistryId": "[resourceId('Microsoft.ContainerRegistry/registries', variables('containerRegistryName'))]",
"subnetClusterId": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), 'cluster')]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2022-05-01",
"name": "[format('{0}', variables('storageAccountName'))]",
"name": "[variables('storageAccountName')]",
"location": "[variables('location')]",
"sku": {
"name": "Standard_RAGRS"
Expand All @@ -62,7 +62,7 @@
{
"type": "Microsoft.KeyVault/vaults",
"apiVersion": "2022-07-01",
"name": "[format('{0}', variables('keyVaultName'))]",
"name": "[variables('keyVaultName')]",
"location": "[variables('location')]",
"properties": {
"tenantId": "[variables('tenantId')]",
Expand All @@ -87,7 +87,7 @@
{
"type": "Microsoft.ContainerRegistry/registries",
"apiVersion": "2022-02-01-preview",
"name": "[format('{0}', variables('containerRegistryName'))]",
"name": "[variables('containerRegistryName')]",
"sku": {
"name": "Standard"
},
Expand All @@ -99,7 +99,7 @@
{
"type": "Microsoft.MachineLearningServices/workspaces",
"apiVersion": "2023-06-01-preview",
"name": "[format('{0}', variables('workspaceName'))]",
"name": "[variables('workspaceName')]",
"identity": {
"type": "SystemAssigned"
},
Expand All @@ -113,9 +113,9 @@
},
"dependsOn": [
"[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]",
"[resourceId('Microsoft.ContainerRegistry/registries', format('{0}', variables('containerRegistryName')))]",
"[resourceId('Microsoft.Storage/storageAccounts', format('{0}', variables('storageAccountName')))]",
"[resourceId('Microsoft.KeyVault/vaults', format('{0}', variables('keyVaultName')))]"
"[resourceId('Microsoft.ContainerRegistry/registries', variables('containerRegistryName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
"[resourceId('Microsoft.KeyVault/vaults', variables('keyVaultName'))]"
]
},
{
Expand Down Expand Up @@ -156,7 +156,7 @@
{
"type": "Microsoft.MachineLearningServices/workspaces/computes",
"apiVersion": "2023-06-01-preview",
"name": "[format('{0}/{1}', format('{0}', variables('workspaceName')), format('login-{0}', variables('resourcePostfix')))]",
"name": "[format('{0}/{1}', variables('workspaceName'), format('login-{0}', variables('resourcePostfix')))]",
"location": "[variables('location')]",
"identity": {
"type": "SystemAssigned"
Expand All @@ -180,7 +180,7 @@
"scripts": {
"creationScript": {
"scriptSource": "inline",
"scriptData": "[base64(format('pip install amlhpc; echo \"export SUBSCRIPTION={0}\" > /etc/profile.d/amlhpc.sh;', subscription().subscriptionId))]"
"scriptData": "[base64('pip install amlhpc \necho \"export SUBSCRIPTION=${subscription().subscriptionId}\" > /etc/profile.d/amlhpc.sh\n')]"
},
"startupScript": {
"scriptSource": "inline",
Expand All @@ -192,13 +192,13 @@
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), 'cluster')]",
"[resourceId('Microsoft.MachineLearningServices/workspaces', format('{0}', variables('workspaceName')))]"
"[resourceId('Microsoft.MachineLearningServices/workspaces', variables('workspaceName'))]"
]
},
{
"type": "Microsoft.MachineLearningServices/workspaces/computes",
"apiVersion": "2023-06-01-preview",
"name": "[format('{0}/{1}', format('{0}', variables('workspaceName')), 'f4s')]",
"name": "[format('{0}/{1}', variables('workspaceName'), 'f4s')]",
"location": "[variables('location')]",
"identity": {
"type": "SystemAssigned"
Expand All @@ -225,7 +225,7 @@
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), 'cluster')]",
"[resourceId('Microsoft.MachineLearningServices/workspaces', format('{0}', variables('workspaceName')))]"
"[resourceId('Microsoft.MachineLearningServices/workspaces', variables('workspaceName'))]"
]
},
{
Expand All @@ -234,24 +234,24 @@
"name": "[guid(format('login-{0}', variables('resourcePostfix')), variables('resourcePostfix'))]",
"properties": {
"roleDefinitionId": "[resourceId('microsoft.authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')]",
"principalId": "[reference(resourceId('Microsoft.MachineLearningServices/workspaces/computes', format('{0}', variables('workspaceName')), format('login-{0}', variables('resourcePostfix'))), '2023-06-01-preview', 'full').identity.principalId]",
"principalId": "[reference(resourceId('Microsoft.MachineLearningServices/workspaces/computes', variables('workspaceName'), format('login-{0}', variables('resourcePostfix'))), '2023-06-01-preview', 'full').identity.principalId]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.MachineLearningServices/workspaces/computes', format('{0}', variables('workspaceName')), format('login-{0}', variables('resourcePostfix')))]"
"[resourceId('Microsoft.MachineLearningServices/workspaces/computes', variables('workspaceName'), format('login-{0}', variables('resourcePostfix')))]"
]
},
{
"type": "Microsoft.MachineLearningServices/workspaces/environments/versions",
"apiVersion": "2023-06-01-preview",
"name": "[format('{0}/amlhpc-ubuntu2004/1', format('{0}', variables('workspaceName')))]",
"name": "[format('{0}/amlhpc-ubuntu2004/1', variables('workspaceName'))]",
"properties": {
"osType": "Linux",
"image": "docker.io/hmeiland/amlhpc-ubuntu2004",
"autoRebuild": "OnBaseImageUpdate"
},
"dependsOn": [
"[resourceId('Microsoft.MachineLearningServices/workspaces', format('{0}', variables('workspaceName')))]"
"[resourceId('Microsoft.MachineLearningServices/workspaces', variables('workspaceName'))]"
]
}
]
Expand Down

0 comments on commit 53d408a

Please sign in to comment.