Skip to content

Commit

Permalink
1. Converted Parameters that are using ARM Template built-in function…
Browse files Browse the repository at this point in the history
…s to variables 2. Generating GUID's for RBAGUID1 and RBAGUID2 in variables3. Updated all references --> paramerters --> Variables (#100)

Co-authored-by: Ian Hellen <[email protected]>
  • Loading branch information
sreedharande and ianhelle authored Sep 16, 2021
1 parent 28ac16f commit 59ed31e
Showing 1 changed file with 35 additions and 76 deletions.
111 changes: 35 additions & 76 deletions Automated-Notebooks/DeploymentTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "string",
"defaultValue": "autonotebook",
"metadata": {
"description": "The name of you Virtual Machine used to execute notebooks."
"description": "The name of your Virtual Machine used to execute notebooks."
}
},
"adminUsername": {
Expand All @@ -17,8 +17,8 @@
}
},
"authenticationType": {
"type": "string",
"defaultValue": "sshPublicKey",
"type": "string",
"defaultValue" : "sshPublicKey",
"allowedValues": [
"sshPublicKey",
"password"
Expand All @@ -32,14 +32,7 @@
"metadata": {
"description": "SSH Key or password for the Virtual Machine. SSH key is recommended."
}
},
"dnsLabelPrefix": {
"type": "string",
"defaultValue": "[toLower(concat('autonotebooks-', uniqueString(resourceGroup().id)))]",
"metadata": {
"description": "Unique DNS Name for the Public IP used to access the Virtual Machine."
}
},
},
"ubuntuOSVersion": {
"type": "string",
"defaultValue": "18.04-LTS",
Expand All @@ -52,99 +45,65 @@
"metadata": {
"description": "The Ubuntu version for the VM. This will pick a fully patched image of this given Ubuntu version."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
},
},
"VmSize": {
"type": "string",
"defaultValue": "Standard_B2s",
"metadata": {
"description": "The size of the VM"
}
},
"virtualNetworkName": {
"type": "string",
"defaultValue": "[concat(parameters('vmName'),'-VNET')]",
"metadata": {
"description": "Name of the VNET"
}
},
"subnetName": {
"type": "string",
"defaultValue": "[concat(parameters('vmName'),'-subnet')]",
"metadata": {
"description": "Name of the subnet in the virtual network"
}
},
"networkSecurityGroupName": {
"type": "string",
"defaultValue": "[concat(parameters('vmName'),'-NSG')]",
"metadata": {
"description": "Name of the Network Security Group"
}
},
},
"SentinelRG" :{
"type": "string",
"defaultValue": "[resourceGroup().id]",
"type": "string",
"metadata": {
"description": "The name of the Resource Group the Sentinel Workspace is in - change if RG is different from RG this VM is being deployed in"
}
},
"SentinelSub" :{
"type": "string",
"defaultValue": "[subscription().subscriptionId]",
"type": "string",
"metadata": {
"description": "The ID of the subscription the Sentinel Workspace is in - change if RG is different from RG this VM is being deployed in"
}
},
"AzureMLSub" :{
"type": "string",
"defaultValue": "[subscription().subscriptionId]",
"type": "string",
"metadata": {
"description": "The ID of the subscription the Azure ML Workspace is in - change if RG is different from RG this VM is being deployed in"
}
},
"AzureMLRG" :{
"type": "string",
"defaultValue": "[resourceGroup().id]",
"type": "string",
"metadata": {
"description": "The name of the Resource Group the Azure ML Workspace is in - change if RG is different from RG this VM is being deployed in"
}
},
"builtInRoleType1": {
"type": "string",
"defaultValue": "Azure Sentinel Responder"
},
"rbacGuid1": {
"type": "string",
"defaultValue": "[newGuid()]"
},
},
"builtInRoleType2": {
"type": "string",
"defaultValue": "Reader"
},
"rbacGuid2": {
"type": "string",
"defaultValue": "[newGuid()]"
}
}
},
"variables": {
"rbac1Scope": "[concat('/subscriptions/', parameters('SentinelSub'), '/resourceGroups/', parameters('SentinelRG'))]",
"rbac2Scope": "[concat('/subscriptions/', parameters('AzureMLSub'), '/resourceGroups/', parameters('AzureMLRG'))]",
"virtualNetworkName":"[concat(parameters('vmName'),'-VNET')]",
"subnetName":"[concat(parameters('vmName'),'-subnet')]",
"vmResourceId": "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]",
"Reader": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'acdd72a7-3385-48ef-bd42-f606fba81ae7')]",
"Azure Sentinel Responder": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', '3e150937-b8fe-4cfb-8069-0eaf05ecd056')]",
"publicIpAddressName": "[concat(parameters('vmName'), 'PublicIP' )]",
"networkInterfaceName": "[concat(parameters('vmName'),'NetInt')]",
"subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkName'), parameters('subnetName'))]",
"subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]",
"osDiskType": "Standard_LRS",
"subnetAddressPrefix": "10.1.0.0/24",
"addressPrefix": "10.1.0.0/16",
"dnsLabelPrefix": "[toLower(concat('autonotebooks-', uniqueString(resourceGroup().id)))]",
"networkSecurityGroupName":"[concat(parameters('vmName'),'-NSG')]",
"rbacGuid1":"[guid(subscription().subscriptionId, deployment().name)]",
"rbacGuid2":"[guid(resourceGroup().id, deployment().name)]",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {
Expand All @@ -162,10 +121,10 @@
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2020-06-01",
"name": "[variables('networkInterfaceName')]",
"location": "[parameters('location')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]",
"[resourceId('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]",
"[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[resourceId('Microsoft.Network/publicIpAddresses/', variables('publicIpAddressName'))]"
],
"properties": {
Expand All @@ -184,15 +143,15 @@
}
],
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups',parameters('networkSecurityGroupName'))]"
"id": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('networkSecurityGroupName'))]"
}
}
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2020-06-01",
"name": "[parameters('networkSecurityGroupName')]",
"location": "[parameters('location')]",
"name": "[variables('networkSecurityGroupName')]",
"location": "[resourceGroup().location]",
"properties": {
"securityRules": [
{
Expand All @@ -214,8 +173,8 @@
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2020-06-01",
"name": "[parameters('virtualNetworkName')]",
"location": "[parameters('location')]",
"name": "[variables('virtualNetworkName')]",
"location": "[resourceGroup().location]",
"properties": {
"addressSpace": {
"addressPrefixes": [
Expand All @@ -224,7 +183,7 @@
},
"subnets": [
{
"name": "[parameters('subnetName')]",
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetAddressPrefix')]",
"privateEndpointNetworkPolicies": "Enabled",
Expand All @@ -238,7 +197,7 @@
"type": "Microsoft.Network/publicIpAddresses",
"apiVersion": "2020-06-01",
"name": "[variables('publicIpAddressName')]",
"location": "[parameters('location')]",
"location": "[resourceGroup().location]",
"sku": {
"name": "Basic",
"tier": "Regional"
Expand All @@ -247,7 +206,7 @@
"publicIpAllocationMethod": "Dynamic",
"publicIPAddressVersion": "IPv4",
"dnsSettings": {
"domainNameLabel": "[parameters('dnsLabelPrefix')]"
"domainNameLabel": "[variables('dnsLabelPrefix')]"
},
"idleTimeoutInMinutes": 4
}
Expand All @@ -256,7 +215,7 @@
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2020-06-01",
"name": "[parameters('vmName')]",
"location": "[parameters('location')]",
"location": "[resourceGroup().location]",
"identity": {
"type": "SystemAssigned"
},
Expand Down Expand Up @@ -309,7 +268,7 @@
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "[guid(parameters('rbacGuid1'))]",
"name": "[guid(variables('rbacGuid1'))]",
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2017-09-01",
"properties": {
Expand All @@ -335,7 +294,7 @@
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "[guid(parameters('rbacGuid2'))]",
"name": "[guid(variables('rbacGuid2'))]",
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2017-09-01",
"properties": {
Expand All @@ -361,6 +320,6 @@
"sshCommand": {
"type": "string",
"value": "[concat('ssh ', parameters('adminUsername'), '@', reference(variables('publicIPAddressName')).dnsSettings.fqdn)]"
}
}
}
}
}

0 comments on commit 59ed31e

Please sign in to comment.