Description
stringlengths 19
200
| IaC
stringlengths 128
8.16k
|
---|---|
This template deploys a VM Scale Set of Linux VMs behind a load balancer with NAT rules for ssh connections. | {"type": "microsoft.compute/virtualmachinescalesets", "name": "[variables('naminginfix')]", "location": "[parameters('location')]", "apiversion": "2017-03-30", "dependson": ["[resourceid('microsoft.network/loadbalancers/", variables('loadbalancername'))]", "[resourceid('microsoft.network/virtualnetworks/", variables('virtualnetworkname'))]"], "sku": {"name": "[parameters('vmsku')]", "tier": "standard", "capacity": "[parameters('instancecount')]"}, "properties": {"overprovision": "true", "upgradepolicy": {"mode": "manual"}, "virtualmachineprofile": {"storageprofile": {"osdisk": {"createoption": "fromimage", "caching": "readwrite"}, "imagereference": "[variables('imagereference')]"}, "osprofile": {"computernameprefix": "[variables('naminginfix')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "[variables('nicname')]", "properties": {"primary": true, "ipconfigurations": [{"name": "[variables('ipconfigname')]", "properties": {"subnet": {"id": "[resourceid('microsoft.network/virtualnetworks/subnets/", variables('virtualnetworkname'), variables('subnetname'))]"}, "loadbalancerbackendaddresspools": [{"id": "[resourceid('microsoft.network/loadbalancers/backendaddresspools/", variables('loadbalancername'), variables('bepoolname'))]"}], "loadbalancerinboundnatpools": [{"id": "[resourceid('microsoft.network/loadbalancers/inboundnatpools/", variables('loadbalancername'), variables('natpoolname'))]"}]}}]}}]}}}} |
Create a VM from a specialized VHD and connect it to a new or existing virtual network | {"type": "microsoft.compute/disks", "apiversion": "2018-09-30", "name": "[variables('diskname')]", "location": "[parameters('location')]", "properties": {"creationdata": {"createoption": "import", "sourceuri": "[parameters('osdiskvhduri')]"}, "ostype": "[parameters('ostype')]"}}{"apiversion": "2018-10-01", "type": "microsoft.compute/virtualmachines", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "tags": {"displayname": "virtualmachine"}, "dependson": ["[variables('nicname')]", "[variables('diskname')]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "storageprofile": {"osdisk": {"ostype": "[parameters('ostype')]", "createoption": "attach", "manageddisk": {"id": "[resourceid('microsoft.compute/disks", variables('diskname'))]"}}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('diagstorageaccountname')).primaryendpoints.blob]"}}}} |
Push a certificate onto a Windows VM | {"apiversion": "2019-07-01", "type": "microsoft.compute/virtualmachines", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces", variables('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[parameters('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]", "secrets": [{"sourcevault": {"id": "[parameters('vaultresourceid')]"}, "vaultcertificates": [{"certificateurl": "[parameters('secreturlwithversion')]", "certificatestore": "my"}]}]}, "storageprofile": {"imagereference": {"publisher": "microsoftwindowsserver", "offer": "windowsserver", "sku": "2019-datacenter", "version": "latest"}, "osdisk": {"caching": "readwrite", "createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('nicname'))]"}]}}} |
Enable data volume encryption on a running Linux VMSS | {"type": "microsoft.compute/virtualmachinescalesets", "name": "[parameters('vmssname')]", "location": "[parameters('location')]", "apiversion": "2021-04-01", "sku": {"name": "standard_d2_v3", "tier": "standard", "capacity": 2}, "properties": {"virtualmachineprofile": {"extensionprofile": {"extensions": [{"name": "[variables('extensionname')]", "properties": {"publisher": "microsoft.azure.security", "type": "[variables('extensionname')]", "typehandlerversion": "[variables('extensionversion')]", "autoupgrademinorversion": true, "forceupdatetag": "[parameters('forceupdatetag')]", "settings": {"encryptionoperation": "[variables('encryptionoperation')]", "keyvaulturl": "[variables('keyvaulturl')]", "keyvaultresourceid": "[variables('keyvaultresourceid')]", "keyencryptionkeyurl": "[parameters('keyencryptionkeyurl')]", "kekvaultresourceid": "[if(empty(parameters('keyencryptionkeyurl')),"",variables('keyvaultresourceid'))]", "keyencryptionalgorithm": "[parameters('keyencryptionalgorithm')]", "volumetype": "[parameters('volumetype')]"}}}]}}}} |
Create a VM from a EfficientIP VHD and connect it to an existing virtual network | {"type": "microsoft.compute/disks", "apiversion": "2017-03-30", "name": "[concat(parameters('vmname'), "_osdisk')]", "location": "[parameters('location')]", "properties": {"creationdata": {"createoption": "import", "sourceuri": "[parameters('osdiskvhduri')]"}, "ostype": "[parameters('ostype')]"}}{"apiversion": "2017-03-30", "type": "microsoft.compute/virtualmachines", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "tags": {"displayname": "virtualmachine"}, "dependson": ["[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]", "[resourceid('microsoft.compute/disks", concat(parameters('vmname'), "_osdisk'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "storageprofile": {"osdisk": {"ostype": "[parameters('ostype')]", "caching": "readwrite", "manageddisk": {"id": "[resourceid('microsoft.compute/disks", concat(parameters('vmname'), "_osdisk'))]"}, "createoption": "attach", "disksizegb": "[parameters('vmdisksizegb')]"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(resourceid('microsoft.storage/storageaccounts", variables('diagstorageaccountname')), "2020-08-01-preview').primaryendpoints.blob]"}}}} |
Disables encryption on an existing Linux VMSS | {"type": "microsoft.compute/virtualmachinescalesets", "name": "[parameters('vmssname')]", "location": "[parameters('location')]", "apiversion": "2020-12-01", "sku": {"name": "standard_d2_v3", "tier": "standard", "capacity": 2}, "properties": {"virtualmachineprofile": {"extensionprofile": {"extensions": [{"name": "[variables('extensionname')]", "properties": {"publisher": "microsoft.azure.security", "type": "[variables('extensionname')]", "typehandlerversion": "[variables('extensionversion')]", "autoupgrademinorversion": true, "forceupdatetag": "[parameters('forceupdatetag')]", "settings": {"volumetype": "[parameters('volumetype')]", "encryptionoperation": "[variables('encryptionoperation')]"}}}]}}}} |
Create a Virtual Machine from a User Image | {"type": "microsoft.compute/images", "apiversion": "2019-12-01", "name": "[variables('imagename')]", "location": "[parameters('location')]", "properties": {"storageprofile": {"osdisk": {"ostype": "[parameters('ostype')]", "osstate": "generalized", "bloburi": "[parameters('osdiskvhduri')]", "storageaccounttype": "standard_lrs"}}, "hypervgeneration": "v2"}}{"apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "dependson": ["[variables('storageaccountname')]", "[variables('nicname')]", "[variables('imagename')]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[parameters('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": {"id": "[resourceid('microsoft.compute/images", variables('imagename'))]"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(resourceid('microsoft.storage/storageaccounts", variables('storageaccountname'))).primaryendpoints.blob]"}}}} |
This template deploys a VM Scale Set of Linux VMs with a load balancer health probe and automatic instance repairs enabled. | {"type": "microsoft.compute/virtualmachinescalesets", "apiversion": "2019-03-01", "name": "[parameters('vmssname')]", "location": "[parameters('location')]", "tags": {"vmsstag": "automaticrepairs"}, "dependson": ["[resourceid('microsoft.network/loadbalancers/", variables('lbname'))]", "[resourceid('microsoft.network/virtualnetworks/", variables('virtualnetworkname'))]"], "sku": {"name": "[parameters('vmsku')]", "tier": "standard", "capacity": "[parameters('instancecount')]"}, "properties": {"upgradepolicy": {"mode": "manual"}, "automaticrepairspolicy": {"enabled": true, "graceperiod": "pt30m"}, "virtualmachineprofile": {"storageprofile": {"imagereference": "[variables('imagereference')]"}, "osprofile": {"computernameprefix": "vmss", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "extensionprofile": {"extensions": [{"name": "customscripttoinstallapache", "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": true, "settings": {"fileuris": ["[uri(parameters('_artifactslocation'), concat('install_apache.sh", parameters('_artifactslocationsastoken')))]"], "commandtoexecute": "sh install_apache.sh"}}}]}, "networkprofile": {"healthprobe": {"id": "[resourceid('microsoft.network/loadbalancers/probes/", variables('lbname'), variables('probename'))]"}, "networkinterfaceconfigurations": [{"name": "nic1", "properties": {"primary": true, "ipconfigurations": [{"name": "ip1", "properties": {"subnet": {"id": "[resourceid('microsoft.network/virtualnetworks/subnets", variables('virtualnetworkname'), variables('subnetname'))]"}, "loadbalancerbackendaddresspools": [{"id": "[variables('bepoolid')]"}], "publicipaddressconfiguration": {"name": "pub1", "properties": {"idletimeoutinminutes": 15}}}}]}}]}}}} |
SQL Server 2014 SP2 Enterprise edition with Auto Backup feature enabled | {"name": "[parameters('virtualmachinename')]", "type": "microsoft.compute/virtualmachines", "apiversion": "2020-06-01", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces/", parameters('networkinterfacename'))]"], "properties": {"osprofile": {"computername": "[parameters('virtualmachinename')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]", "windowsconfiguration": {"provisionvmagent": true}}, "hardwareprofile": {"vmsize": "[parameters('virtualmachinesize')]"}, "storageprofile": {"imagereference": {"publisher": "microsoftsqlserver", "offer": "sql2014sp2-ws2012r2", "sku": "enterprise", "version": "latest"}, "osdisk": {"createoption": "fromimage", "manageddisk": {"storageaccounttype": "[parameters('storageaccounttype')]"}}, "datadisks": [{"createoption": "empty", "manageddisk": {"storageaccounttype": "[parameters('storageaccounttype')]"}, "lun": 0, "disksizegb": 1023, "caching": "readonly"}, {"createoption": "empty", "manageddisk": {"storageaccounttype": "[parameters('storageaccounttype')]"}, "lun": 1, "disksizegb": 1023, "caching": "readonly"}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", parameters('networkinterfacename'))]"}]}}}{"apiversion": "2020-06-01", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('virtualmachinename'), "/sqliaasextension')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines/", parameters('virtualmachinename'))]"], "properties": {"type": "sqliaasagent", "publisher": "microsoft.sqlserver.management", "typehandlerversion": "1.2", "autoupgrademinorversion": true, "settings": {"autotelemetrysettings": {"region": "[parameters('location')]"}, "autobackupsettings": {"enable": true, "retentionperiod": "[parameters('sqlautobackupretentionperiod')]", "enableencryption": true}}, "protectedsettings": {"storageurl": "[reference(resourceid('microsoft.storage/storageaccounts", parameters('sqlautobackupstorageaccountname')), "2015-06-15').primaryendpoints["blob"]]", "storageaccesskey": "[listkeys(resourceid('microsoft.storage/storageaccounts", parameters('sqlautobackupstorageaccountname')), "2015-06-15').key1]", "password": "[parameters('sqlautobackupencryptionpassword')]"}}} |
Template for deploying VMSS with Public IP Prefix | {"type": "microsoft.compute/virtualmachinescalesets", "apiversion": "2020-06-01", "name": "[parameters('vmssname')]", "location": "[parameters('location')]", "sku": {"name": "[parameters('vmsku')]", "tier": "standard", "capacity": "[parameters('instancecount')]"}, "properties": {"overprovision": false, "upgradepolicy": {"mode": "manual"}, "virtualmachineprofile": {"storageprofile": {"osdisk": {"caching": "readonly", "createoption": "fromimage"}, "imagereference": "[variables('imagereference')]"}, "osprofile": {"computernameprefix": "[parameters('vmssname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "[variables('nicname')]", "properties": {"primary": true, "ipconfigurations": [{"name": "[variables('ipconfigname')]", "properties": {"subnet": {"id": "[format('{0}/subnets/{1}", resourceid('microsoft.network/virtualnetworks", variables('virtualnetworkname')), variables('subnetname'))]"}, "publicipaddressconfiguration": {"name": "pub1", "properties": {"idletimeoutinminutes": 15, "publicipprefix": {"id": "[resourceid('microsoft.network/publicipprefixes", variables('publicipprefixname'))]"}}}, "loadbalancerbackendaddresspools": [{"id": "[format('{0}/backendaddresspools/{1}", resourceid('microsoft.network/loadbalancers", variables('loadbalancername')), variables('bepoolname'))]"}], "loadbalancerinboundnatpools": [{"id": "[format('{0}/inboundnatpools/{1}", resourceid('microsoft.network/loadbalancers", variables('loadbalancername')), variables('natpoolname'))]"}]}}]}}]}}}, "dependson": ["[resourceid('microsoft.network/loadbalancers", variables('loadbalancername'))]", "[resourceid('microsoft.network/publicipprefixes", variables('publicipprefixname'))]", "[resourceid('microsoft.network/virtualnetworks", variables('virtualnetworkname'))]"]} |
SQL Server 2014 SP1 Enterprise edition with Azure Key Vault Integration feature enabled | {"name": "[parameters('virtualmachinename')]", "type": "microsoft.compute/virtualmachines", "apiversion": "2020-12-01", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces", parameters('networkinterfacename'))]"], "properties": {"osprofile": {"computername": "[parameters('virtualmachinename')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]", "windowsconfiguration": {"provisionvmagent": true}}, "hardwareprofile": {"vmsize": "[parameters('virtualmachinesize')]"}, "storageprofile": {"imagereference": {"publisher": "microsoftsqlserver", "offer": "sql2014sp3-ws2012r2", "sku": "enterprise", "version": "latest"}, "osdisk": {"name": "[concat(parameters('virtualmachinename'), "_osdisk')]", "createoption": "fromimage", "manageddisk": {"storageaccounttype": "[parameters('storageaccounttype')]"}}, "datadisks": [{"name": "[concat(parameters('virtualmachinename'), "_datadisk-1')]", "createoption": "empty", "lun": 0, "disksizegb": 1023, "caching": "readonly"}, {"name": "[concat(parameters('virtualmachinename'), "_datadisk-2')]", "createoption": "empty", "lun": 1, "disksizegb": 1023, "caching": "readonly"}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", parameters('networkinterfacename'))]"}]}}}{"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('virtualmachinename'), "/sqliaasextension')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines", parameters('virtualmachinename'))]"], "properties": {"type": "sqliaasagent", "publisher": "microsoft.sqlserver.management", "typehandlerversion": "1.2", "autoupgrademinorversion": true, "settings": {"autotelemetrysettings": {"region": "[parameters('location')]"}, "keyvaultcredentialsettings": {"enable": true, "credentialname": "[parameters('sqlakvcredentialname')]"}}, "protectedsettings": {"privatekeyvaultcredentialsettings": {"azurekeyvaulturl": "[variables('sqlakvurl')]", "serviceprincipalname": "[parameters('sqlakvprincipalname')]", "serviceprincipalsecret": "[parameters('sqlakvprincipalsecret')]"}}}} |
This template allows you to deploy a simple VM (Windows or Ubuntu), using the latest patched version. | {"type": "microsoft.compute/virtualmachines", "apiversion": "2020-06-01", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces", variables('networkinterfacename'))]"], "zones": ["[parameters('zone')]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "storageprofile": {"osdisk": {"createoption": "fromimage", "manageddisk": {"storageaccounttype": "[variables('osdisktype')]"}}, "imagereference": {"publisher": "canonical", "offer": "ubuntuserver", "sku": "[parameters('ubuntuosversion')]", "version": "latest"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('networkinterfacename'))]"}]}, "osprofile": {"computername": "[parameters('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}}} |
This template enables encryption on a running Windows VM Scale Set | {"type": "microsoft.compute/virtualmachinescalesets/extensions", "name": "[concat(parameters('vmssname'),"/diskencryption')]", "apiversion": "2020-12-01", "dependson": ["[resourceid('microsoft.keyvault/vaults", parameters('keyvaultname'))]"], "location": "[parameters('location')]", "properties": {"publisher": "microsoft.azure.security", "type": "azurediskencryption", "typehandlerversion": "2.2", "autoupgrademinorversion": true, "settings": {"encryptionoperation": "[variables('encryptionoperation')]", "keyvaulturl": "[variables('keyvaulturl')]", "keyvaultresourceid": "[resourceid('microsoft.keyvault/vaults/", parameters('keyvaultname'))]", "volumetype": "all"}}} |
This template deploys a VM with 3 IP configurations, two of which have public IP addresses associated with them. | {"type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "apiversion": "2020-06-01", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces", variables('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[parameters('imagepublisher')]", "offer": "[parameters('imageoffer')]", "sku": "[parameters('osversion')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('nicname'))]", "properties": {"primary": true}}]}}} |
Discover Private IP dynamically | {"type": "microsoft.compute/availabilitysets", "name": "[variables('availabilitysetname')]", "apiversion": "2020-12-01", "location": "[parameters('location')]", "properties": {"platformfaultdomaincount": 2, "platformupdatedomaincount": 2}, "sku": {"name": "aligned"}}{"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines", "name": "[concat(parameters('vmname'), copyindex())]", "location": "[parameters('location')]", "copy": {"name": "foo", "count": "[parameters('scalenumber')]"}, "dependson": ["[resourceid('microsoft.storage/storageaccounts/", parameters('newstorageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", concat(variables('nicname'), copyindex()))]", "[resourceid('microsoft.compute/availabilitysets/", variables('availabilitysetname'))]"], "properties": {"availabilityset": {"id": "[resourceid('microsoft.compute/availabilitysets", variables('availabilitysetname'))]"}, "hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[concat(parameters('vmname'), copyindex())]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": {"publisher": "[parameters('imagepublisher')]", "offer": "[parameters('imageoffer')]", "sku": "[parameters('imagesku')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", concat(variables('nicname'), copyindex()))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(parameters('newstorageaccountname'), "2021-02-01').primaryendpoints["blob"]]"}}}}{"type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'), "1/", variables('vmextensionname'))]", "apiversion": "2020-12-01", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines/", concat(parameters('vmname'), "1'))]", "[resourceid('microsoft.network/networkinterfaces/", concat(variables('nicname'), "0'))]"], "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": true, "settings": {"fileuris": ["[uri(parameters('_artifactslocation'), concat('privateip.sh", parameters('_artifactslocationsastoken')))]"], "commandtoexecute": "[concat(parameters('customscriptcommandtoexecute'), reference(resourceid('microsoft.network/networkinterfaces", concat(variables('nicname'), "0'))).ipconfigurations[0].properties.privateipaddress)]"}}} |
Setup or Update Existing SQL Server with Auto Patching | {"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('existingvirtualmachinename'), "/sqliaasextension')]", "location": "[parameters('location')]", "properties": {"type": "sqliaasagent", "publisher": "microsoft.sqlserver.management", "typehandlerversion": "1.2", "autoupgrademinorversion": "true", "settings": {"autopatchingsettings": {"patchcategory": "windowsmandatoryupdates", "enable": true, "dayofweek": "[parameters('sqlautopatchingdayofweek')]", "maintenancewindowstartinghour": "[parameters('sqlautopatchingstarthour')]", "maintenancewindowduration": "[parameters('sqlautopatchingwindowduration')]"}}}} |
2 VMs in a Load Balancer and NAT rules | {"type": "microsoft.compute/availabilitysets", "name": "[variables('availabilitysetname')]", "apiversion": "2016-04-30-preview", "location": "[parameters('location')]", "properties": {"platformfaultdomaincount": 2, "platformupdatedomaincount": 2, "managed": true}}{"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines", "name": "[concat(parameters('vmnameprefix'), copyindex())]", "copy": {"name": "virtualmachineloop", "count": "[variables('numberofinstances')]"}, "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts", variables('storageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces", concat(parameters('nicnameprefix'), copyindex()))]", "[resourceid('microsoft.compute/availabilitysets", variables('availabilitysetname'))]"], "properties": {"availabilityset": {"id": "[resourceid('microsoft.compute/availabilitysets",variables('availabilitysetname'))]"}, "hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[concat(parameters('vmnameprefix'), copyindex())]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[parameters('imagepublisher')]", "offer": "[parameters('imageoffer')]", "sku": "[parameters('imagesku')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", concat(parameters('nicnameprefix'),copyindex()))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('storageaccountname'), "2021-01-01').primaryendpoints.blob]"}}}} |
This template deploys a Custom Windows Image behind a load balancer with HTTP load balancing rules | {"type": "microsoft.compute/images", "apiversion": "2017-03-30", "name": "[variables('imagename')]", "location": "[resourcegroup().location]", "properties": {"storageprofile": {"osdisk": {"ostype": "windows", "osstate": "generalized", "bloburi": "[parameters('sourceimagevhduri')]", "storageaccounttype": "standard_lrs"}}}}{"type": "microsoft.compute/virtualmachinescalesets", "apiversion": "2017-03-30", "name": "[parameters('vmssname')]", "location": "[resourcegroup().location]", "dependson": ["[concat('microsoft.network/loadbalancers/",variables('lbname'))]", "[concat('microsoft.network/virtualnetworks/",variables('virtualnetworkname'))]", "[concat('microsoft.compute/images/",variables('imagename'))]"], "sku": {"name": "[parameters('vmsize')]", "tier": "standard", "capacity": "[parameters('instancecount')]"}, "properties": {"overprovision": "true", "upgradepolicy": {"mode": "manual"}, "virtualmachineprofile": {"storageprofile": {"imagereference": {"id": "[resourceid('microsoft.compute/images", variables('imagename'))]"}}, "osprofile": {"computernameprefix": "[parameters('vmssname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "nic1", "properties": {"primary": true, "ipconfigurations": [{"name": "ip1", "properties": {"subnet": {"id": "[variables('subnetref')]"}, "loadbalancerbackendaddresspools": [{"id": "[variables('lbbeaddresspoolid')]"}]}}]}}]}}}} |
This template takes a minimum amount of parameters and deploys a Windows VM with tags, using the latest patched version. | {"apiversion": "2019-07-01", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "tags": {"department": "[parameters('departmentname')]", "application": "[parameters('applicationname')]", "created by": "[parameters('createdby')]"}, "dependson": ["[resourceid('microsoft.storage/storageaccounts", variables('storageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces", variables('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[parameters('windowsosversion')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('storageaccountname')).primaryendpoints["blob"]]"}}}} |
This template enables encryption on a running windows VM | {"type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'),"/", variables('extensionname'))]", "location": "[parameters('location')]", "apiversion": "2020-06-01", "properties": {"publisher": "microsoft.azure.security", "type": "[variables('extensionname')]", "typehandlerversion": "[variables('extensionversion')]", "autoupgrademinorversion": true, "forceupdatetag": "[parameters('forceupdatetag')]", "settings": {"encryptionoperation": "[variables('encryptionoperation')]", "keyvaulturl": "[reference(variables('keyvaultresourceid'), "2019-09-01').vaulturi]", "keyvaultresourceid": "[variables('keyvaultresourceid')]", "keyencryptionkeyurl": "[parameters('keyencryptionkeyurl')]", "kekvaultresourceid": "[variables('keyvaultresourceid')]", "keyencryptionalgorithm": "[variables('keyencryptionalgorithm')]", "volumetype": "[parameters('volumetype')]", "resizeosdisk": "[parameters('resizeosdisk')]"}}} |
This template creates a VNet with multiple subnets and deploys a Ubuntu VM with multiple NICs | {"type": "microsoft.compute/virtualmachines", "apiversion": "2020-06-01", "dependson": ["[resourceid('microsoft.storage/storageaccounts/", variables('storageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", variables('nic1name'))]", "[resourceid('microsoft.network/networkinterfaces/", variables('nic2name'))]"], "location": "[parameters('location')]", "name": "[parameters('vmname')]", "properties": {"diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(resourceid('microsoft.storage/storageaccounts/", variables('storageaccountname')), "2019-06-01').primaryendpoints.blob]"}}, "hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('nic1name'))]", "properties": {"primary": true}}, {"id": "[resourceid('microsoft.network/networkinterfaces", variables('nic2name'))]", "properties": {"primary": false}}]}, "osprofile": {"computername": "[parameters('vmname')]", "adminusername": "[parameters('adminusername')]", "linuxconfiguration": {"disablepasswordauthentication": true, "ssh": {"publickeys": [{"path": "[variables('sshkeypath')]", "keydata": "[parameters('sshkeydata')]"}]}}}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[parameters('ubuntuosversion')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}}} |
Creates a virtual machine with RDP port | {"apiversion": "2020-06-01", "type": "microsoft.compute/virtualmachines", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts", variables('storageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", concat(parameters('vmname'), "-nic'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[parameters('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[variables('imagesku')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",concat(parameters('vmname'),"-nic'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('storageaccountname'), "2020-08-01-preview').primaryendpoints.blob]"}}}} |
This template takes deploys a VM by retrieving the password securely from a Key Vault | {"apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[variables('storageaccountname')]", "[variables('nicname')]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[parameters('windowsosversion')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}, "datadisks": [{"disksizegb": 1023, "lun": 0, "createoption": "empty"}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('storageaccountname')).primaryendpoints.blob]"}}}} |
VMs distributed across Availability Zones with a Load Balancer and NAT rules | {"apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines", "name": "[concat(parameters('dnsname'), copyindex())]", "zones": "[split(string(add(mod(copyindex(),3),1)), ",')]", "copy": {"name": "virtualmachineloop", "count": "[parameters('numberofvms')]"}, "location": "[parameters('location')]", "dependson": ["nicloop"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[concat(parameters('dnsname'), copyindex())]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": "[if(equals(parameters('windowsorubuntu'), "windows'), variables('windowsimage'), variables('linuximage'))]", "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",concat(variables('nicname'),copyindex()))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(resourceid('microsoft.storage/storageaccounts/", variables('storageaccountname'))).primaryendpoints.blob]"}}}} |
illustrates how to Store SSL certs from a 3rd party CA securely in Key Vault and deploy to a VMSS | {"type": "microsoft.compute/virtualmachinescalesets", "name": "[variables('naminginfix')]", "location": "[parameters('location')]", "apiversion": "2016-04-30-preview", "dependson": ["[concat('microsoft.network/loadbalancers/", variables('lbname'))]", "[concat('microsoft.network/virtualnetworks/", variables('virtualnetworkname'))]"], "sku": {"name": "[parameters('vmsku')]", "tier": "standard", "capacity": "[parameters('capacity')]"}, "properties": {"overprovision": "true", "upgradepolicy": {"mode": "manual"}, "virtualmachineprofile": {"storageprofile": {"osdisk": {"caching": "readwrite", "createoption": "fromimage"}, "imagereference": "[variables('imagereference')]"}, "osprofile": {"computernameprefix": "[variables('naminginfix')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "secrets": [{"sourcevault": {"id": "[resourceid(parameters('vaultresourcegroup'), "microsoft.keyvault/vaults", parameters('vaultname'))]"}, "vaultcertificates": [{"certificateurl": "[parameters('httpssecreturlwithversion')]"}, {"certificateurl": "[parameters('httpssecretcaurlwithversion')]"}]}], "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "[variables('nicname')]", "properties": {"primary": true, "ipconfigurations": [{"name": "[variables('ipconfigname')]", "properties": {"subnet": {"id": "[resourceid( "microsoft.network/virtualnetworks/subnets", variables('virtualnetworkname'), variables('subnetname'))]"}, "loadbalancerbackendaddresspools": [{"id": "[resourceid('microsoft.network/loadbalancers/backendaddresspools", variables('lbname'), variables('bepoolname'))]"}], "loadbalancerinboundnatpools": [{"id": "[resourceid( "microsoft.network/loadbalancers/inboundnatpools", variables('lbname'), variables('natpoolname'))]"}]}}]}}]}, "extensionprofile": {"extensions": [{"name": "lapextension", "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": false, "settings": {"fileuris": ["[concat(parameters('_artifactslocation'), "/", parameters('scriptfilename'), parameters('_artifactslocationsastoken'))]"]}, "protectedsettings": {"commandtoexecute": "[concat('bash ", parameters('scriptfilename'), " ", parameters('certthumbprint'), " ", parameters('cacertthumbprint'))]"}}}]}}}} |
This template creates a new encrypted managed disks windows vm using the server 2k12 gallery image. | {"apiversion": "2019-07-01", "type": "microsoft.compute/virtualmachines", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]"], "identity": {"type": "systemassigned"}, "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[parameters('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[variables('ossku')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}, "datadisks": [{"disksizegb": 512, "lun": 1, "name": "datadisk-01", "createoption": "empty", "caching": "none"}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}}}{"type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'),"/diskencryption')]", "apiversion": "2020-12-01", "dependson": ["[resourceid('microsoft.keyvault/vaults", parameters('keyvaultname'))]"], "location": "[parameters('location')]", "properties": {"publisher": "microsoft.azure.security", "type": "azurediskencryption", "typehandlerversion": "2.2", "autoupgrademinorversion": true, "settings": {"encryptionoperation": "[variables('encryptionoperation')]", "keyvaulturl": "[variables('keyvaulturl')]", "keyvaultresourceid": "[variables('keyvaultresourceid')]", "volumetype": "all"}}} |
This template enables encryption on a running windows vm using AAD client cert thumbprint. | {"type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'),"/", variables('extensionname'))]", "apiversion": "2016-04-30-preview", "location": "[parameters('location')]", "properties": {"publisher": "microsoft.azure.security", "type": "azurediskencryption", "typehandlerversion": "[variables('extensionversion')]", "autoupgrademinorversion": true, "forceupdatetag": "[parameters('sequenceversion')]", "settings": {"aadclientid": "[parameters('aadclientid')]", "aadclientcertthumbprint": "[parameters('aadclientcertthumbprint')]", "keyvaulturl": "[variables('keyvaulturl')]", "keyencryptionkeyurl": "[parameters('keyencryptionkeyurl')]", "keyencryptionalgorithm": "[variables('keyencryptionalgorithm')]", "volumetype": "[parameters('volumetype')]", "encryptionoperation": "[variables('encryptionoperation')]"}}} |
This template joins a VM to an existing domain | {"type": "microsoft.compute/virtualmachines", "apiversion": "2021-03-01", "name": "[parameters('dnslabelprefix')]", "location": "[parameters('location')]", "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[parameters('dnslabelprefix')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[variables('windowsosversion')]", "version": "latest"}, "osdisk": {"name": "[format('{0}-osdisk", parameters('dnslabelprefix'))]", "caching": "readwrite", "createoption": "fromimage"}, "datadisks": [{"name": "[format('{0}-datadisk", parameters('dnslabelprefix'))]", "caching": "none", "createoption": "empty", "disksizegb": 1024, "lun": 0}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(resourceid('microsoft.storage/storageaccounts", parameters('storageaccountname'))).primaryendpoints.blob]"}}}, "dependson": ["[resourceid('microsoft.network/networkinterfaces", variables('nicname'))]", "[resourceid('microsoft.storage/storageaccounts", parameters('storageaccountname'))]"]}{"type": "microsoft.compute/virtualmachines/extensions", "apiversion": "2021-03-01", "name": "[format('{0}/{1}", parameters('dnslabelprefix'), "joindomain')]", "location": "[parameters('location')]", "properties": {"publisher": "microsoft.compute", "type": "jsonaddomainextension", "typehandlerversion": "1.3", "autoupgrademinorversion": true, "settings": {"name": "[parameters('domaintojoin')]", "oupath": "[parameters('oupath')]", "user": "[format('{0}\\{1}", parameters('domaintojoin'), parameters('domainusername'))]", "restart": true, "options": "[parameters('domainjoinoptions')]"}, "protectedsettings": {"password": "[parameters('domainpassword')]"}}, "dependson": ["[resourceid('microsoft.compute/virtualmachines", parameters('dnslabelprefix'))]"]} |
This template takes a minimum amount of parameters and deploys a Premium Windows VM, using the latest patched version. | {"apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts/", parameters('newstorageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[parameters('windowsosversion')]", "version": "latest"}, "osdisk": {"name": "[concat(variables('vmname'),"_osdisk')]", "caching": "readwrite", "createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('nicname'))]"}]}}} |
This template deploys a VM Scale Set of Linux VMs behind a load balancer with NAT rules, and direct public IPv4 connections. | {"type": "microsoft.compute/virtualmachinescalesets", "name": "[parameters('vmssname')]", "location": "[parameters('location')]", "apiversion": "2017-03-30", "dependson": ["[resourceid('microsoft.network/loadbalancers/", variables('loadbalancername'))]", "[resourceid('microsoft.network/virtualnetworks/", variables('virtualnetworkname'))]"], "sku": {"name": "[parameters('vmsku')]", "tier": "standard", "capacity": "[parameters('instancecount')]"}, "properties": {"overprovision": "false", "upgradepolicy": {"mode": "manual"}, "virtualmachineprofile": {"storageprofile": {"osdisk": {"caching": "readonly", "createoption": "fromimage"}, "imagereference": "[variables('imagereference')]"}, "osprofile": {"computernameprefix": "[parameters('vmssname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "[variables('nicname')]", "properties": {"primary": true, "ipconfigurations": [{"name": "[variables('ipconfigname')]", "properties": {"subnet": {"id": "[resourceid('microsoft.network/virtualnetworks/subnets/", variables('virtualnetworkname'), variables('subnetname'))]"}, "publicipaddressconfiguration": {"name": "pub1", "properties": {"idletimeoutinminutes": 15}}, "loadbalancerbackendaddresspools": [{"id": "[resourceid('microsoft.network/loadbalancers/backendaddresspools/", variables('loadbalancername'), variables('bepoolname'))]"}], "loadbalancerinboundnatpools": [{"id": "[resourceid('microsoft.network/loadbalancers/inboundnatpools/", variables('loadbalancername'), variables('natpoolname'))]"}]}}]}}]}}}} |
Deploys a Windows VM and install a file on that VM using the Custom Script Extension | {"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[variables('nicname')]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "microsoftwindowsserver", "offer": "windowsserver", "sku": "2016-datacenter", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}}, "resources": [{"type": "extensions", "name": "customscriptextension", "apiversion": "2020-12-01", "location": "[parameters('location')]", "dependson": ["[variables('vmname')]"], "properties": {"publisher": "microsoft.compute", "type": "customscriptextension", "typehandlerversion": "1.8", "autoupgrademinorversion": true, "settings": {"fileuris": ["[uri(parameters('_artifactslocation'), concat(variables('scriptfolder'),"/",variables('scriptfilename'), parameters('_artifactslocationsastoken')))]"], "commandtoexecute": "[concat('powershell -executionpolicy unrestricted -file ", variables('scriptfolder'), "/", variables('scriptfilename'), " ", variables('scriptparameters'))]"}}}]} |
This template takes a minimum amount of parameters and deploys a Linux VM with Accelerated Networking, using the latest patched version. | {"type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "apiversion": "2020-06-01", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts/", variables('storageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[variables('ubuntuosversion')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}, "datadisks": [{"disksizegb": 1023, "lun": 0, "createoption": "empty"}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(resourceid('microsoft.storage/storageaccounts", variables('storageaccountname')), "2020-08-01-preview').primaryendpoints["blob"]]"}}}} |
This template enables encryption on a running linux vm using AAD client secret. | {"type": "microsoft.compute/virtualmachines/extensions", "apiversion": "2020-12-01", "location": "[parameters('location')]", "name": "[concat(parameters('vmname'),"/diskencryption')]", "properties": {"publisher": "microsoft.azure.security", "type": "[variables('extensionname')]", "typehandlerversion": "[variables('extensionversion')]", "autoupgrademinorversion": true, "forceupdatetag": "[parameters('forceupdatetag')]", "settings": {"encryptionoperation": "[variables('encryptionoperation')]", "keyvaulturl": "[variables('keyvaulturl')]", "keyvaultresourceid": "[variables('keyvaultresourceid')]", "keyencryptionkeyurl": "[parameters('keyencryptionkeyurl')]", "kekvaultresourceid": "[if(empty(parameters('keyencryptionkeyurl')),"",variables('keyvaultresourceid'))]", "keyencryptionalgorithm": "[parameters('keyencryptionalgorithm')]", "volumetype": "[parameters('volumetype')]"}}} |
This template deploys a VM Scale Set of Windows VMs behind a load balancer with NAT rules for RDP connections and Auto scale integrated | {"type": "microsoft.compute/virtualmachinescalesets", "apiversion": "2021-03-01", "name": "[parameters('vmssname')]", "location": "[parameters('location')]", "sku": {"name": "[parameters('vmsku')]", "tier": "standard", "capacity": "[parameters('instancecount')]"}, "properties": {"overprovision": true, "upgradepolicy": {"mode": "manual"}, "virtualmachineprofile": {"storageprofile": {"osdisk": {"createoption": "fromimage", "caching": "readwrite"}, "imagereference": "[variables('imagereference')]"}, "osprofile": {"computernameprefix": "[variables('naminginfix')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "[variables('nicname')]", "properties": {"primary": true, "ipconfigurations": [{"name": "[variables('ipconfigname')]", "properties": {"subnet": {"id": "[resourceid('microsoft.network/virtualnetworks/subnets", variables('virtualnetworkname'), variables('subnetname'))]"}, "loadbalancerbackendaddresspools": [{"id": "[resourceid('microsoft.network/loadbalancers/backendaddresspools", variables('loadbalancername'), variables('bepoolname'))]"}], "loadbalancerinboundnatpools": [{"id": "[resourceid('microsoft.network/loadbalancers/inboundnatpools", variables('loadbalancername'), variables('natpoolname'))]"}]}}]}}]}}}, "dependson": ["[resourceid('microsoft.network/loadbalancers", variables('loadbalancername'))]", "[resourceid('microsoft.network/virtualnetworks", variables('virtualnetworkname'))]"]} |
This template disables encryption on a running Windows VM Scale Set | {"type": "microsoft.compute/virtualmachinescalesets/extensions", "name": "[concat(parameters('vmssname'),"/", "azurediskencryption')]", "location": "[parameters('location')]", "apiversion": "2020-12-01", "properties": {"publisher": "microsoft.azure.security", "type": "azurediskencryption", "typehandlerversion": "2.2", "autoupgrademinorversion": true, "forceupdatetag": "[parameters('forceupdatetag')]", "settings": {"encryptionoperation": "disableencryption", "volumetype": "[parameters('volumetype')]"}}} |
This template takes a minimum amount of parameters and deploys a Jupyter server on a Ubuntu Linux VM. | {"type": "microsoft.compute/virtualmachines", "apiversion": "2019-07-01", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces/", variables('networkinterfacename'))]", "[resourceid('microsoft.storage/storageaccounts/", variables('storageaccountname'))]"], "properties": {"hardwareprofile": {"vmsize": "[variables('vmsize')[parameters('cpu-gpu')]]"}, "storageprofile": {"osdisk": {"createoption": "fromimage", "manageddisk": {"storageaccounttype": "standardssd_lrs"}}, "datadisks": [{"lun": 0, "name": "[concat('datadisk", parameters('vmname'))]", "createoption": "empty", "disksizegb": "[parameters('disksizegb')]"}], "imagereference": {"publisher": "canonical", "offer": "ubuntuserver", "sku": "18.04-lts", "version": "latest"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('networkinterfacename'))]"}]}, "osprofile": {"computername": "[parameters('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[concat(reference(variables('storageaccountname')).primaryendpoints.blob)]"}}}, "resources": [{"type": "microsoft.compute/virtualmachines/extensions", "apiversion": "2019-07-01", "name": "[concat(variables('vmname'),"/installscript')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines", variables('vmname'))]"], "tags": {"displayname": "execute my custom script"}, "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": true, "protectedsettings": {"commandtoexecute": "[concat('bash install.sh ", parameters('adminusername'))]", "fileuris": ["[uri(parameters('_artifactslocation'), concat('scripts/install.sh", parameters('_artifactslocationsastoken')))]", "[uri(parameters('_artifactslocation'), concat('scripts/bootstrap.py", parameters('_artifactslocationsastoken')))]"]}}}]} |
This template uses a property copy loop to deploy a VM with a variable number of data disks determined by the parameter passed to the template. | {"apiversion": "2020-06-01", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[parameters('osversion')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}, "copy": [{"name": "datadisks", "count": "[parameters('numberofdatadisks')]", "input": {"disksizegb": 1023, "lun": "[copyindex('datadisks')]", "createoption": "empty"}}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}}} |
This template creates a Ubuntu VM and installs the DSCForLinux extension 2.70 or latest | {"apiversion": "2015-05-01-preview", "type": "microsoft.compute/virtualmachines", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts/", parameters('newstorageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[parameters('vmname')]", "adminusername": "[parameters('username')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[parameters('ubuntuosversion')]", "version": "latest"}, "osdisk": {"name": "osdisk1", "vhd": {"uri": "[uri(reference(resourceid('microsoft.storage/storageaccounts", parameters('newstorageaccountname')), "2021-01-01').primaryendpoints["blob"], concat('/", variables('vmstorageaccountcontainername'),"/",variables('osdiskname'),".vhd'))]"}, "caching": "readwrite", "createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}}}{"apiversion": "2015-05-01-preview", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'),"/enabledsc')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines/", parameters('vmname'))]"], "properties": {"publisher": "microsoft.ostcextensions", "type": "dscforlinux", "typehandlerversion": "2.0", "settings": {"mode": "[parameters('mode')]", "fileuri": "[parameters('fileuri')]"}, "protectedsettings": {"registrationurl": "[parameters('registrationurl')]", "registrationkey": "[parameters('registrationkey')]"}}} |
This template disables encryption on a running windows VM which was encrypted without AAD | {"type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'),"/","azurediskencryption')]", "location": "[parameters('location')]", "apiversion": "2019-12-01", "properties": {"publisher": "microsoft.azure.security", "type": "azurediskencryption", "typehandlerversion": "2.2", "autoupgrademinorversion": true, "forceupdatetag": "[parameters('forceupdatetag')]", "settings": {"encryptionoperation": "disableencryption", "volumetype": "[parameters('volumetype')]"}}} |
This template deploys a VM Scale Set into an exsisting vnet. | {"type": "microsoft.compute/virtualmachinescalesets", "name": "[parameters('vmssname')]", "location": "[parameters('location')]", "apiversion": "2019-12-01", "dependson": ["[resourceid('microsoft.network/loadbalancers", variables('loadbalancername'))]"], "sku": {"name": "[parameters('vmsku')]", "capacity": "[parameters('instancecount')]"}, "properties": {"overprovision": true, "upgradepolicy": {"mode": "manual"}, "virtualmachineprofile": {"storageprofile": {"osdisk": {"createoption": "fromimage", "caching": "readwrite"}, "imagereference": {"publisher": "canonical", "offer": "ubuntuserver", "sku": "16.04-lts", "version": "latest"}}, "osprofile": {"computernameprefix": "[parameters('vmssname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "nic", "properties": {"primary": true, "ipconfigurations": [{"name": "ipconfig", "properties": {"subnet": {"id": "[resourceid(parameters('existingvnetresourcegroupname'), "microsoft.network/virtualnetworks/subnets", parameters('existingvnetname'), parameters('existingsubnetname'))]"}, "loadbalancerbackendaddresspools": [{"id": "[resourceid('microsoft.network/loadbalancers/backendaddresspools", variables('loadbalancername'), variables('loadbalancerbackendname'))]"}], "loadbalancerinboundnatpools": [{"id": "[resourceid('microsoft.network/loadbalancers/inboundnatpools", variables('loadbalancername'), variables('loadbalancernatpoolname'))]"}]}}]}}]}}}} |
This template takes a minimum amount of parameters and deploys a Premium Windows VM, using the latest patched version. | {"apiversion": "2016-04-30-preview", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts/", parameters('vmdiagnosticsstorageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[parameters('windowsosversion')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[concat('http://",parameters('vmdiagnosticsstorageaccountname'), ".blob.", environment().suffixes.storage)]"}}}, "resources": [{"type": "extensions", "name": "microsoft.insights.vmdiagnosticssettings", "apiversion": "2015-05-01-preview", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines/", variables('vmname'))]"], "properties": {"publisher": "microsoft.azure.diagnostics", "type": "iaasdiagnostics", "typehandlerversion": "1.4", "autoupgrademinorversion": true, "settings": {"xmlcfg": "[base64(variables('wadcfgx'))]", "storageaccount": "[parameters('vmdiagnosticsstorageaccountname')]"}, "protectedsettings": {"storageaccountname": "[parameters('vmdiagnosticsstorageaccountname')]", "storageaccountkey": "[listkeys(variables('accountid'),"2015-05-01-preview').key1]", "storageaccountendpoint": "[parameters('storageaccountendpoint')]"}}}]} |
This template enables encryption on a running Linux VM | {"type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'),"/", variables('extensionname'))]", "location": "[parameters('location')]", "apiversion": "2020-12-01", "properties": {"publisher": "microsoft.azure.security", "type": "[variables('extensionname')]", "typehandlerversion": "[variables('extensionversion')]", "autoupgrademinorversion": true, "forceupdatetag": "[parameters('forceupdatetag')]", "settings": {"encryptionoperation": "[variables('encryptionoperation')]", "keyvaulturl": "[reference(variables('keyvaultresourceid'),"2016-10-01').vaulturi]", "keyvaultresourceid": "[variables('keyvaultresourceid')]", "keyencryptionkeyurl": "[parameters('keyencryptionkeyurl')]", "kekvaultresourceid": "[if(empty(parameters('keyencryptionkeyurl')),"",variables('keyvaultresourceid'))]", "keyencryptionalgorithm": "[variables('keyencryptionalgorithm')]", "volumetype": "[parameters('volumetype')]"}}} |
Deploy a Virtual Machine with Custom Data | {"apiversion": "2016-04-30-preview", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts/", variables('storageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "customdata": "[base64(parameters('customdata'))]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[parameters('ubuntuosversion')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('storageaccountname'), variables('apiversion')).primaryendpoints["blob"]]"}}}} |
This template will deploy SUSE Linux Enterprise Server VM (SLES), using the Pay-As-You-Go SLES VM image. Additional charges apply. | {"type": "microsoft.compute/virtualmachines", "apiversion": "2019-12-01", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[variables('storageaccountname')]", "[variables('nicname')]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": {"publisher": "suse", "offer": "[parameters('suseosversion')]", "sku": "gen1", "version": "latest"}, "osdisk": {"name": "[concat(variables('vmname'),"_osdisk')]", "caching": "readwrite", "createoption": "fromimage"}, "datadisks": [{"disksizegb": 100, "lun": 0, "name": "[concat(variables('vmname'),"_datadisk1')]", "createoption": "empty"}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(resourceid('microsoft.storage/storageaccounts/", variables('storageaccountname')), "2019-06-01').primaryendpoints.blob]"}}}} |
This template deploys a linux VM with an MSI that has access to a storage account in a different resource group. | {"type": "microsoft.compute/virtualmachines", "apiversion": "2019-03-01", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces/", variables('networkinterfacename'))]"], "identity": {"type": "systemassigned"}, "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[parameters('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"osdisk": {"createoption": "fromimage", "manageddisk": {"storageaccounttype": "[variables('osdisktype')]"}}, "imagereference": {"publisher": "canonical", "offer": "ubuntuserver", "sku": "[parameters('ubuntuosversion')]", "version": "latest"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('networkinterfacename'))]"}]}}} |
This template takes a minimum amount of parameters and deploys an Image Definition. | {"type": "microsoft.compute/galleries/images", "name": "[concat(parameters('galleryname'), "/", parameters('galleryimagedefinitionname'))]", "apiversion": "2019-12-01", "location": "[parameters('location')]", "properties": {"description": "sample gallery image description", "ostype": "linux", "osstate": "generalized", "endoflifedate": "2030-01-01", "identifier": {"publisher": "mypublisher", "offer": "myoffer", "sku": "mysku"}, "recommended": {"vcpus": {"min": "1", "max": "64"}, "memory": {"min": "2048", "max": "307720"}}}} |
This template creates a Ubuntu VM and installs the CustomScript extension | {"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('username')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[variables('ubuntuosversion')]", "version": "latest"}, "osdisk": {"caching": "readwrite", "createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}}}{"type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(variables('vmname'),"/installcustomscript')]", "apiversion": "2020-12-01", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines/", variables('vmname'))]"], "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": true, "settings": {"fileuris": ["[uri(parameters('_artifactslocation'), concat('scripts/hello.sh", parameters('_artifactslocationsastoken')))]"], "commandtoexecute": "[parameters('commandtoexecute')]"}}} |
This template creates a VM in a VNET which is in a different Resource Group | {"apiversion": "2020-06-01", "type": "microsoft.compute/virtualmachines", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts/", parameters('newstorageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", parameters('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[parameters('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": {"publisher": "[parameters('imagepublisher')]", "offer": "[parameters('imageoffer')]", "sku": "[parameters('imagesku')]", "version": "latest"}, "osdisk": {"name": "[concat(parameters('vmname'),"_osdisk')]", "caching": "readwrite", "createoption": "fromimage", "manageddisk": {"storageaccounttype": "standardssd_lrs"}}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", parameters('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(resourceid('microsoft.storage/storageaccounts", tolower(parameters('newstorageaccountname')))).primaryendpoints.blob]"}}}} |
Deploy a Virtual Machine with User Data | {"apiversion": "2021-03-01", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[variables('nicname')]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "userdata": "[base64(parameters('userdata'))]", "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[parameters('ubuntuosversion')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}}} |
Showcase a Virus attack on a Virtual Machine detection & prevention. | {"type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(variables('vmnames')[copyindex(1)],"/malware')]", "apiversion": "2020-12-01", "location": "[parameters('location')]", "dependson": ["omsextension"], "copy": {"name": "copy-extension-malware", "count": 1}, "properties": {"publisher": "microsoft.azure.security", "type": "iaasantimalware", "typehandlerversion": "1.1", "autoupgrademinorversion": true, "settings": {"antimalwareenabled": true, "exclusions": {"processes": "taskmgr.exe"}, "realtimeprotectionenabled": "true", "scheduledscansettings": {"isenabled": "true", "scantype": "quick", "day": "7", "time": "120"}}}} |
This template takes a minimum amount of parameters and deploys a trusted launch capable Windows virtual machine, using the latest patched version. | {"type": "microsoft.compute/virtualmachines", "apiversion": "2020-12-01", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "identity": {"type": "systemassigned"}, "dependson": ["[resourceid('microsoft.network/networkinterfaces", parameters('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[parameters('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": "[variables('imagereference')[parameters('sku')]]", "osdisk": {"createoption": "fromimage", "manageddisk": {"storageaccounttype": "standardssd_lrs"}}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", parameters('nicname'))]"}]}, "securityprofile": {"uefisettings": {"securebootenabled": "[parameters('secureboot')]", "vtpmenabled": "[parameters('vtpm')]"}, "securitytype": "trustedlaunch"}}}{"condition": "[and(equals(parameters('vtpm'), "true'), equals(parameters('secureboot'), "true'))]", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'), "/", variables('extensionname'))]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines", parameters('vmname'))]"], "apiversion": "2020-06-01", "properties": {"publisher": "[variables('extensionpublisher')]", "type": "[variables('extensionname')]", "typehandlerversion": "[variables('extensionversion')]", "autoupgrademinorversion": true, "settings": {"attestationendpointcfg": {"maaendpoint": "[parameters('maaendpoint')]", "maatenantname": "[variables('maatenantname')]", "ascreportingendpoint": "[variables('ascreportingendpoint')]", "usealternatetoken": "[variables('usealternatetoken')]", "disablealerts": "[variables('disablealerts')]"}}}} |
This template will create N number of VM's with managed disks, public IPs and network interfaces. | {"type": "microsoft.compute/availabilitysets", "apiversion": "2020-06-01", "name": "[parameters('availabilitysetname')]", "location": "[parameters('location')]", "properties": {"platformfaultdomaincount": "[variables('availabilitysetplatformfaultdomaincount')]", "platformupdatedomaincount": "[variables('availabilitysetplatformupdatedomaincount')]"}, "sku": {"name": "aligned"}}{"copy": {"name": "virtualmachines", "count": "[length(range(0, parameters('virtualmachinecount')))]"}, "type": "microsoft.compute/virtualmachines", "apiversion": "2020-06-01", "name": "[format('{0}{1}", parameters('virtualmachinenameprefix'), add(range(0, parameters('virtualmachinecount'))[copyindex()], 1))]", "location": "[parameters('location')]", "properties": {"hardwareprofile": {"vmsize": "[parameters('virtualmachinesize')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('operatingsystemvalues')[parameters('operatingsystem')].publishervalue]", "offer": "[variables('operatingsystemvalues')[parameters('operatingsystem')].offervalue]", "sku": "[variables('operatingsystemvalues')[parameters('operatingsystem')].skuvalue]", "version": "latest"}, "osdisk": {"name": "[format('{0}{1}", parameters('virtualmachinenameprefix'), add(range(0, parameters('virtualmachinecount'))[copyindex()], 1))]", "createoption": "fromimage", "manageddisk": {"storageaccounttype": "standardssd_lrs"}, "caching": "readwrite"}}, "osprofile": {"computername": "[format('{0}{1}", parameters('virtualmachinenameprefix'), add(range(0, parameters('virtualmachinecount'))[copyindex()], 1))]", "adminusername": "[parameters('virtualmachineadminusername')]", "windowsconfiguration": {"provisionvmagent": true}, "adminpassword": "[parameters('virtualmachineadminpassword')]"}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", format('{0}{1}-nic1", parameters('virtualmachinenameprefix'), add(range(0, parameters('virtualmachinecount'))[range(0, parameters('virtualmachinecount'))[copyindex()]], 1)))]"}]}, "availabilityset": {"id": "[resourceid('microsoft.compute/availabilitysets", parameters('availabilitysetname'))]"}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(resourceid('microsoft.storage/storageaccounts", variables('diagnosticstorageaccountname'))).primaryendpoints.blob]"}}}, "dependson": ["[resourceid('microsoft.compute/availabilitysets", parameters('availabilitysetname'))]", "[resourceid('microsoft.network/networkinterfaces", format('{0}{1}-nic1", parameters('virtualmachinenameprefix'), add(range(0, parameters('virtualmachinecount'))[range(0, parameters('virtualmachinecount'))[copyindex()]], 1)))]", "[resourceid('microsoft.storage/storageaccounts", variables('diagnosticstorageaccountname'))]"]} |
Joins a Windows virtual machine into an AD Domain | {"comments": "join domain - jsonaddomainextension", "apiversion": "2015-06-15", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(trim(variables('vmlistarray')[copyindex()]),"/joindomain')]", "location": "[parameters('location')]", "copy": {"name": "vmdomainjoincopy", "count": "[length(variables('vmlistarray'))]"}, "properties": {"publisher": "microsoft.compute", "type": "jsonaddomainextension", "typehandlerversion": "1.3", "autoupgrademinorversion": true, "settings": {"name": "[parameters('domainfqdn')]", "user": "[parameters('domainjoinusername')]", "restart": "true", "options": "[variables('domainjoinoptions')]", "oupath": "[parameters('oupath')]"}, "protectedsettings": {"password": "[parameters('domainjoinuserpassword')]"}}} |
This template disables encryption on a running Linux vm | {"type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'),"/","azurediskencryptionforlinux')]", "location": "[parameters('location')]", "apiversion": "2020-12-01", "properties": {"publisher": "microsoft.azure.security", "type": "azurediskencryptionforlinux", "typehandlerversion": "1.1", "autoupgrademinorversion": true, "forceupdatetag": "[parameters('forceupdatetag')]", "settings": {"encryptionoperation": "disableencryption", "volumetype": "[parameters('volumetype')]"}}} |
This template creates a mount point on every VM and connects it to an Azure Files SMB share. | {"type": "microsoft.compute/virtualmachinescalesets", "name": "[parameters('vmssname')]", "location": "[parameters('location')]", "apiversion": "2020-12-01", "dependson": ["[resourceid('microsoft.network/loadbalancers/", variables('loadbalancername'))]", "[resourceid('microsoft.network/virtualnetworks/", variables('virtualnetworkname'))]"], "sku": {"name": "[parameters('vmsku')]", "tier": "standard", "capacity": "[parameters('instancecount')]"}, "properties": {"overprovision": false, "upgradepolicy": {"mode": "manual"}, "virtualmachineprofile": {"storageprofile": {"osdisk": {"createoption": "fromimage", "caching": "readwrite"}, "imagereference": "[variables('imagereference')]"}, "osprofile": {"computernameprefix": "[parameters('vmssname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "[variables('nicname')]", "properties": {"primary": true, "ipconfigurations": [{"name": "[variables('ipconfigname')]", "properties": {"subnet": {"id": "[resourceid('microsoft.network/virtualnetworks/subnets/", variables('virtualnetworkname'), variables('subnetname'))]"}, "loadbalancerbackendaddresspools": [{"id": "[resourceid('microsoft.network/loadbalancers/backendaddresspools/", variables('loadbalancername'), variables('bepoolname'))]"}], "loadbalancerinboundnatpools": [{"id": "[resourceid('microsoft.network/loadbalancers/inboundnatpools/", variables('loadbalancername'), variables('natpoolname'))]"}, {"id": "[resourceid('microsoft.network/loadbalancers/inboundnatpools", variables('loadbalancername'),"natpool2')]"}]}}]}}]}, "extensionprofile": {"extensions": [{"name": "filesextension", "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": true, "settings": {"fileuris": ["[uri(parameters('_artifactslocation'), concat('mountazurefiles.sh", parameters('_artifactslocationsastoken')))]"]}, "protectedsettings": {"commandtoexecute": "[concat('bash mountazurefiles.sh ", parameters('storageaccountname'), " ", parameters('storageaccountkey'), " ", parameters('sharename'), " ", parameters('mountpointpath'), " ", parameters('adminusername'))]"}}}]}}}} |
This template deploys a VM Scale Set of Windows VMs with incoming web connections balanced by the Azure Application Gateway | {"type": "microsoft.compute/virtualmachinescalesets", "name": "[variables('naminginfix')]", "location": "[parameters('location')]", "apiversion": "2016-04-30-preview", "dependson": ["[resourceid('microsoft.network/virtualnetworks/", variables('virtualnetworkname'))]", "[resourceid('microsoft.network/applicationgateways/", variables('appgwname'))]"], "sku": {"name": "[parameters('vmsku')]", "tier": "standard", "capacity": "[parameters('instancecount')]"}, "properties": {"overprovision": "true", "singleplacementgroup": "false", "upgradepolicy": {"mode": "automatic"}, "virtualmachineprofile": {"storageprofile": {"osdisk": {"caching": "readwrite", "createoption": "fromimage"}, "imagereference": "[variables('imagereference')]"}, "osprofile": {"computernameprefix": "[variables('naminginfix')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "[variables('nicname')]", "properties": {"primary": true, "ipconfigurations": [{"name": "[variables('ipconfigname')]", "properties": {"subnet": {"id": "[resourceid('microsoft.network/virtualnetworks/subnets/", variables('virtualnetworkname'), variables('subnetname'))]"}, "applicationgatewaybackendaddresspools": [{"id": "[resourceid('microsoft.network/applicationgateways/backendaddresspools/", variables('appgwname'), variables('appgwbepoolname'))]"}]}}]}}]}}}} |
Create a template with dynamic selection of data disks | {"apiversion": "2019-03-01", "type": "microsoft.compute/virtualmachines", "name": "[concat(variables('vmname'), copyindex())]", "location": "[parameters('location')]", "copy": {"name": "vmloop", "count": "[parameters('numberofvms')]"}, "dependson": ["[variables('storageaccountname')]", "nicloop"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[concat(variables('vmname'), copyindex())]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "microsoftwindowsserver", "offer": "windowsserver", "sku": "[parameters('windowsosversion')]", "version": "latest"}, "osdisk": {"name": "[concat(variables('vmname'), copyindex(),"_osdisk')]", "caching": "readwrite", "createoption": "fromimage"}, "copy": [{"name": "datadisks", "count": "[parameters('numdatadisks')]", "input": {"caching": "readwrite", "disksizegb": "[parameters('sizeofdatadisksingb')]", "lun": "[copyindex('datadisks')]", "name": "[concat(variables('vmname'), "-datadisk",copyindex(), copyindex('datadisks'))]", "createoption": "empty"}}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", concat(variables('nicname'), copyindex()))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('storageaccountname')).primaryendpoints.blob]"}}}} |
This template deploys a VM Scale Set of Ubuntu VMs with incoming web connections balanced by the Azure Application Gateway | {"type": "microsoft.compute/virtualmachinescalesets", "name": "[variables('naminginfix')]", "location": "[parameters('location')]", "apiversion": "2017-03-30", "dependson": ["[resourceid('microsoft.network/virtualnetworks/", variables('virtualnetworkname'))]", "[resourceid('microsoft.network/applicationgateways/", variables('appgwname'))]"], "sku": {"name": "[parameters('vmsku')]", "tier": "standard", "capacity": "[parameters('instancecount')]"}, "properties": {"overprovision": "true", "singleplacementgroup": "false", "upgradepolicy": {"mode": "automatic"}, "virtualmachineprofile": {"storageprofile": {"osdisk": {"caching": "readwrite", "createoption": "fromimage"}, "imagereference": "[variables('imagereference')]"}, "osprofile": {"computernameprefix": "[variables('naminginfix')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "[variables('nicname')]", "properties": {"primary": true, "ipconfigurations": [{"name": "[variables('ipconfigname')]", "properties": {"subnet": {"id": "[resourceid('microsoft.network/virtualnetworks/subnets/", variables('virtualnetworkname'), variables('subnetname'))]"}, "applicationgatewaybackendaddresspools": [{"id": "[resourceid('microsoft.network/applicationgateways/backendaddresspools/", variables('appgwname'), variables('appgwbepoolname'))]"}]}}]}}]}}}} |
This is a common template for creating single instance CentOS or UbuntuServer with configurable number of data disks automounted (configurable sizes)[MDADM RAID0 Array]. Docker 1.12.x is available. | {"type": "microsoft.compute/availabilitysets", "name": "[variables('avsetname')]", "apiversion": "2020-12-01", "location": "[parameters('location')]", "sku": {"name": "aligned"}, "properties": {"platformfaultdomaincount": 2, "platformupdatedomaincount": 5}}{"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines", "name": "[parameters('mastervmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]", "[resourceid('microsoft.compute/availabilitysets/", variables('avsetname'))]"], "properties": {"availabilityset": {"id": "[resourceid('microsoft.compute/availabilitysets", variables('avsetname'))]"}, "hardwareprofile": {"vmsize": "[parameters('nodesize')]"}, "osprofile": {"computername": "[parameters('mastervmname')]", "adminusername": "[parameters('adminusername')]", "linuxconfiguration": {"disablepasswordauthentication": true, "ssh": {"publickeys": [{"path": "[variables('sshkeypath')]", "keydata": "[parameters('sshpublickey')]"}]}}}, "storageprofile": {"imagereference": {"publisher": "[parameters('imagepublisher')]", "offer": "[parameters('imageoffer')]", "sku": "[parameters('imagesku')]", "version": "latest"}, "osdisk": {"name": "[concat(parameters('mastervmname'),"_osdisk')]", "caching": "readwrite", "createoption": "fromimage"}, "copy": [{"name": "datadisks", "count": "[parameters('numdatadisks')]", "input": {"caching": "[variables('diskcaching')]", "disksizegb": "[parameters('datadisksize')]", "lun": "[copyindex('datadisks')]", "name": "[concat(parameters('mastervmname'),"-datadisk",copyindex('datadisks'))]", "createoption": "empty"}}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}}}{"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('mastervmname'), "/installation')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines/", parameters('mastervmname'))]"], "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": true, "settings": {"fileuris": ["[uri(parameters('_artifactslocation'), concat('azuredeploy.sh", parameters('_artifactslocationsastoken')))]"], "commandtoexecute": "[variables('installationcli')]"}}} |
This template deploys a Windows VM with Windows Admin Center extension for remote management | {"type": "microsoft.compute/virtualmachines", "apiversion": "2021-11-01", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[parameters('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "microsoftwindowsserver", "offer": "windowsserver", "sku": "[parameters('osversion')]", "version": "latest"}, "osdisk": {"createoption": "fromimage", "manageddisk": {"storageaccounttype": "standardssd_lrs"}}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(resourceid('microsoft.storage/storageaccounts", variables('storageaccountname'))).primaryendpoints.blob]"}}}, "dependson": ["[resourceid('microsoft.network/networkinterfaces", variables('nicname'))]", "[resourceid('microsoft.storage/storageaccounts", variables('storageaccountname'))]"]}{"type": "microsoft.compute/virtualmachines/extensions", "apiversion": "2021-11-01", "name": "[format('{0}/{1}", parameters('vmname'), "admincenter')]", "location": "[parameters('location')]", "properties": {"publisher": "microsoft.admincenter", "type": "admincenter", "typehandlerversion": "0.0", "autoupgrademinorversion": true, "settings": {"port": "[variables('windowsadmincenterport')]", "salt": "[guid(resourcegroup().id, parameters('vmname'))]"}}, "dependson": ["[resourceid('microsoft.compute/virtualmachines", parameters('vmname'))]"]} |
SQL Server 2014 SP1 Enterprise edition with Auto Patching feature enabled | {"type": "microsoft.compute/virtualmachines", "name": "[parameters('virtualmachinename')]", "apiversion": "2017-03-30", "location": "[parameters('location')]", "comments": "windows vm", "tags": {"displayname": "virtual machine"}, "dependson": ["[resourceid('microsoft.storage/storageaccounts/", variables('storageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", variables('vmnicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('virtualmachinesize')]"}, "osprofile": {"computername": "windowsvm", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]", "windowsconfiguration": {"provisionvmagent": "true"}}, "storageprofile": {"imagereference": {"publisher": "microsoftsqlserver", "offer": "sql2014sp2-ws2012r2", "sku": "enterprise", "version": "latest"}, "osdisk": {"name": "[concat(parameters('virtualmachinename'), "_osdisk')]", "caching": "readwrite", "createoption": "fromimage"}, "datadisks": [{"name": "[concat(parameters('virtualmachinename'), "_datadisk1')]", "createoption": "empty", "lun": 0, "disksizegb": 1023, "caching": "readonly"}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('vmnicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(resourceid('microsoft.storage/storageaccounts/", variables('storageaccountname'))).primaryendpoints.blob]"}}}}{"apiversion": "2015-06-15", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('virtualmachinename'), "/sqliaasextension')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines/", parameters('virtualmachinename'))]"], "properties": {"type": "sqliaasagent", "publisher": "microsoft.sqlserver.management", "typehandlerversion": "1.2", "autoupgrademinorversion": "true", "settings": {"autotelemetrysettings": {"region": "[parameters('location')]"}, "autopatchingsettings": {"patchcategory": "windowsmandatoryupdates", "enable": true, "dayofweek": "sunday", "maintenancewindowstartinghour": "2", "maintenancewindowduration": "60"}, "keyvaultcredentialsettings": {"enable": false}, "serverconfigurationsmanagementsettings": {"sqlconnectivityupdatesettings": {"connectivitytype": "private", "port": "1433"}, "sqlworkloadtypeupdatesettings": {"sqlworkloadtype": "general"}, "sqlstorageupdatesettings": {"diskcount": "1", "numberofcolumns": "1", "startingdeviceid": "2", "diskconfigurationtype": "new"}, "additionalfeaturesserverconfigurations": {"isrservicesenabled": "false"}}}}} |
This template creates a new encrypted windows vm using the server 2k12 gallery image. | {"apiversion": "2019-07-01", "type": "microsoft.compute/virtualmachines", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]"], "identity": {"type": "systemassigned"}, "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[parameters('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[variables('ossku')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}}}{"type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'),"/diskencryption')]", "apiversion": "2019-03-01", "dependson": ["[resourceid('microsoft.keyvault/vaults", parameters('keyvaultname'))]"], "location": "[parameters('location')]", "properties": {"publisher": "microsoft.azure.security", "type": "azurediskencryption", "typehandlerversion": "2.2", "autoupgrademinorversion": true, "settings": {"encryptionoperation": "[variables('encryptionoperation')]", "keyvaulturl": "[variables('keyvaulturl')]", "keyvaultresourceid": "[variables('keyvaultresourceid')]", "volumetype": "all"}}} |
This template deploys a Windows VM Scale Set with custom script extension behind a load balancer with NAT rules for rdp connections. | {"type": "microsoft.compute/virtualmachinescalesets", "name": "[parameters('vmssname')]", "location": "[parameters('location')]", "apiversion": "2020-12-01", "dependson": ["[resourceid('microsoft.network/virtualnetworks", variables('vnetname'))]", "[resourceid('microsoft.network/loadbalancers", variables('loadbalancername'))]"], "sku": {"name": "[parameters('vmsku')]", "capacity": "[parameters('instancecount')]"}, "properties": {"overprovision": "true", "upgradepolicy": {"mode": "manual"}, "virtualmachineprofile": {"storageprofile": {"osdisk": {"createoption": "fromimage", "caching": "readwrite"}, "imagereference": {"publisher": "microsoftwindowsserver", "offer": "windowsserver", "sku": "2016-datacenter", "version": "latest"}}, "osprofile": {"computernameprefix": "[parameters('vmssname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "nic", "properties": {"primary": true, "ipconfigurations": [{"name": "ipconfig", "properties": {"subnet": {"id": "[variables('subnetref')]"}, "loadbalancerbackendaddresspools": [{"id": "[resourceid('microsoft.network/loadbalancers/backendaddresspools", variables('loadbalancername'), variables('loadbalancerbackendname'))]"}], "loadbalancerinboundnatpools": [{"id": "[resourceid('microsoft.network/loadbalancers/inboundnatpools", variables('loadbalancername'), variables('loadbalancernatpoolname'))]"}]}}]}}]}, "extensionprofile": {"extensions": [{"name": "customscript", "properties": {"publisher": "microsoft.compute", "settings": {"fileuris": ["[variables('scriptlocation')]"]}, "typehandlerversion": "1.8", "autoupgrademinorversion": true, "protectedsettings": {"commandtoexecute": "powershell -executionpolicy unrestricted -file scripts/helloworld.ps1"}, "type": "customscriptextension"}}]}}}} |
This template will create N number of VM's with managed disks, public IPs and network interfaces in a VMSS in Flexible Orchestration Mode.. | {"type": "microsoft.compute/virtualmachinescalesets", "name": "[parameters('virtualmachinescalesetname')]", "apiversion": "2021-07-01", "location": "[parameters('location')]", "properties": {"singleplacementgroup": false, "platformfaultdomaincount": "[variables('virtualmachinescalesetplatformfaultdomaincount')]"}, "zones": "[variables('selectedzone')]"}{"type": "microsoft.compute/virtualmachines", "name": "[concat(parameters('virtualmachinenameprefix'), copyindex(1))]", "apiversion": "2021-07-01", "location": "[parameters('location')]", "copy": {"name": "vmcopy", "count": "[parameters('virtualmachinecount')]"}, "dependson": ["[resourceid('microsoft.compute/virtualmachinescalesets/", parameters('virtualmachinescalesetname'))]", "[resourceid('microsoft.network/networkinterfaces", concat(parameters('virtualmachinenameprefix'), copyindex(1), "-nic1'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('virtualmachinesize')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('operatingsystemvalues')[parameters('operatingsystem')].publishervalue]", "offer": "[variables('operatingsystemvalues')[parameters('operatingsystem')].offervalue]", "sku": "[variables('operatingsystemvalues')[parameters('operatingsystem')].skuvalue]", "version": "latest"}, "osdisk": {"name": "[concat(parameters('virtualmachinenameprefix'),copyindex(1))]", "createoption": "fromimage", "manageddisk": {"storageaccounttype": "premium_lrs"}, "caching": "readwrite"}}, "osprofile": {"computername": "[concat(parameters('virtualmachinenameprefix'),copyindex(1))]", "adminusername": "[parameters('virtualmachineadminusername')]", "adminpassword": "[parameters('virtualmachineadminpassword')]"}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", concat(parameters('virtualmachinenameprefix'), copyindex(1), "-nic1'))]"}]}, "virtualmachinescaleset": {"id": "[resourceid('microsoft.compute/virtualmachinescalesets", parameters('virtualmachinescalesetname'))]"}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true}}}} |
This template deploys a VM Scale Set of Windows VMs behind a load balancer with NAT rules for RDP connections. | {"type": "microsoft.compute/virtualmachinescalesets", "apiversion": "2020-12-01", "name": "[parameters('vmssname')]", "location": "[parameters('location')]", "zones": ["1"], "dependson": ["[variables('loadbalancername')]", "[variables('virtualnetworkname')]"], "sku": {"name": "standard_a1_v2", "tier": "standard", "capacity": "[parameters('instancecount')]"}, "properties": {"overprovision": true, "upgradepolicy": {"mode": "manual"}, "virtualmachineprofile": {"storageprofile": {"osdisk": {"caching": "readwrite", "createoption": "fromimage"}, "imagereference": "[variables('imagereference')]"}, "osprofile": {"computernameprefix": "[parameters('vmssname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "[variables('nicname')]", "properties": {"networksecuritygroup": {"id": "[resourceid('microsoft.network/networksecuritygroups", variables('networksecuritygroupname'))]"}, "primary": true, "ipconfigurations": [{"name": "[variables('ipconfigname')]", "properties": {"subnet": {"id": "[resourceid('microsoft.network/virtualnetworks/subnets", variables('virtualnetworkname'), variables('subnetname'))]"}, "loadbalancerbackendaddresspools": [{"id": "[resourceid('microsoft.network/loadbalancers/backendaddresspools", variables('loadbalancername'), variables('bepoolname'))]"}], "loadbalancerinboundnatpools": [{"id": "[resourceid('microsoft.network/loadbalancers/inboundnatpools", variables('loadbalancername'), variables('natpoolname'))]"}]}}]}}]}}}} |
This template create a single and simple Linux VM with console and serial output turned on. | {"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts/", variables('storageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[variables('imagesku')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('storageaccountname'), variables('apiversion')).primaryendpoints["blob"]]"}}}} |
This template creates a Windows VM and runs a PowerShell script using the custom script extension. It also discovers the Storage Account keys | {"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[variables('nicname')]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "microsoftwindowsserver", "offer": "windowsserver", "sku": "2016-datacenter", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}}, "resources": [{"type": "extensions", "name": "customscriptextension", "apiversion": "2020-12-01", "location": "[parameters('location')]", "dependson": ["[variables('vmname')]"], "properties": {"publisher": "microsoft.compute", "type": "customscriptextension", "typehandlerversion": "1.8", "autoupgrademinorversion": true, "settings": {"fileuris": ["[uri(parameters('_artifactslocation'), concat(variables('scriptfolder'),"/",variables('scriptfilename'), parameters('_artifactslocationsastoken')))]"], "commandtoexecute": "[concat('powershell -executionpolicy unrestricted -file ", variables('scriptfolder'), "/", variables('scriptfilename'), " ", variables('scriptparameters'))]"}, "protectedsettings": {"storageaccountname": "[parameters('customscriptstorageaccountname')]", "storageaccountkey": "[listkeys(variables('accountid'),"2021-01-01').keys[0].value]"}}}]} |
This template allows you to deploy a Terraform workstation as a Linux VM with MSI. | {"apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces", variables('nicname'))]"], "identity": {"type": "systemassigned"}, "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": {"publisher": "canonical", "offer": "ubuntuserver", "sku": "18.04-lts", "version": "latest"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('infrastorageaccountname')).primaryendpoints.blob]"}}}}{"name": "[concat(variables('vmname'),"/customscriptextension')]", "type": "microsoft.compute/virtualmachines/extensions", "apiversion": "2019-07-01", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.authorization/roleassignments", guid(resourcegroup().id, variables('contributor')))]"], "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": true, "settings": {"fileuris": ["[uri(parameters('_artifactslocation'), concat('scripts/infra.sh", parameters('_artifactslocationsastoken')))]", "[uri(parameters('_artifactslocation'), concat('scripts/install.sh", parameters('_artifactslocationsastoken')))]", "[uri(parameters('_artifactslocation'), concat('scripts/desktop.sh", parameters('_artifactslocationsastoken')))]", "[uri(parameters('_artifactslocation'), concat('scripts/azureproviderandcreds.tf", parameters('_artifactslocationsastoken')))]"]}}} |
This template takes a minimum amount of parameters and deploys a simple Linux VM, using the latest patched version. | {"type": "microsoft.compute/virtualmachines", "apiversion": "2020-06-01", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "storageprofile": {"osdisk": {"createoption": "fromimage", "manageddisk": {"storageaccounttype": "[variables('osdisktype')]"}}, "imagereference": {"publisher": "canonical", "offer": "ubuntuserver", "sku": "[parameters('ubuntuosversion')]", "version": "latest"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('networkinterfacename'))]"}]}, "osprofile": {"computername": "[parameters('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), null(), variables('linuxconfiguration'))]"}}, "dependson": ["[resourceid('microsoft.network/networkinterfaces", variables('networkinterfacename'))]"]} |
This template deploys a new Linux VMSS and jumpbox and enables encryption on the data volumes of the Linux VMSS instances. | {"type": "microsoft.compute/virtualmachines", "name": "[variables('jumpboxname')]", "location": "[parameters('location')]", "apiversion": "2017-03-30", "dependson": ["[variables('jumpboxsaname')]", "[variables('jumpboxnicname')]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsku')]"}, "osprofile": {"computername": "[variables('jumpboxname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": "[variables('imagereference')]", "osdisk": {"caching": "readwrite", "createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('jumpboxnicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('jumpboxsaname')).primaryendpoints.blob]"}}}}{"type": "microsoft.compute/virtualmachinescalesets", "name": "[parameters('vmssname')]", "location": "[parameters('location')]", "apiversion": "2017-03-30", "dependson": ["[variables('virtualnetworkname')]"], "sku": {"name": "[parameters('vmsku')]", "tier": "standard", "capacity": "[parameters('instancecount')]"}, "properties": {"overprovision": true, "upgradepolicy": {"mode": "automatic"}, "virtualmachineprofile": {"storageprofile": {"imagereference": "[variables('imagereference')]", "osdisk": {"createoption": "fromimage"}, "copy": [{"name": "datadisks", "count": 4, "input": {"lun": "[copyindex('datadisks')]", "disksizegb": 10, "createoption": "empty", "caching": "none"}}]}, "osprofile": {"computernameprefix": "[variables('naminginfix')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "customdata": "[variables('customdata')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "[variables('nicname')]", "properties": {"primary": true, "ipconfigurations": [{"name": "[variables('ipconfigname')]", "properties": {"subnet": {"id": "[variables('subnetid')]"}}}]}}]}, "extensionprofile": {"extensions": [{"name": "[variables('extensionname')]", "properties": {"publisher": "microsoft.azure.security", "type": "[variables('extensionname')]", "typehandlerversion": "[variables('extensionversion')]", "autoupgrademinorversion": true, "forceupdatetag": "[parameters('forceupdatetag')]", "settings": {"encryptionoperation": "[variables('encryptionoperation')]", "keyvaulturl": "[reference(variables('keyvaultresourceid'),"2016-10-01').vaulturi]", "keyvaultresourceid": "[variables('keyvaultresourceid')]", "kekvaultresourceid": "[variables('keyvaultresourceid')]", "keyencryptionkeyurl": "[parameters('keyencryptionkeyurl')]", "keyencryptionalgorithm": "[parameters('keyencryptionalgorithm')]", "volumetype": "[parameters('volumetype')]"}}}]}}}} |
Create a VM with multiple network interfaces and RDP accessible | {"apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmnameprefix')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts/", parameters('storageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", variables('nic1nameprefix'))]", "[resourceid('microsoft.network/networkinterfaces/", variables('nic2nameprefix'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmnameprefix')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[variables('imagesku')]", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"properties": {"primary": true}, "id": "[resourceid('microsoft.network/networkinterfaces",variables('nic1nameprefix'))]"}, {"properties": {"primary": false}, "id": "[resourceid('microsoft.network/networkinterfaces",variables('nic2nameprefix'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(parameters('storageaccountname'), "2019-06-01').primaryendpoints.blob]"}}}} |
Setup or Update Existing SQL Server with credentials using Azure Key Vault | {"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('existingvirtualmachinename'), "/sqliaasextension')]", "location": "[parameters('location')]", "properties": {"type": "sqliaasagent", "publisher": "microsoft.sqlserver.management", "typehandlerversion": "1.2", "autoupgrademinorversion": "true", "settings": {"keyvaultcredentialsettings": {"enable": true, "credentialname": "[parameters('sqlcredentialname')]"}}, "protectedsettings": {"privatekeyvaultcredentialsettings": {"azurekeyvaulturl": "[variables('sqlakvurl')]", "serviceprincipalname": "[parameters('serviceprincipalname')]", "serviceprincipalsecret": "[parameters('serviceprincipalsecret')]"}}}} |
This template creates a Ubuntu VM and installs the OSPatching extension | {"apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts/", parameters('newstorageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('username')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[variables('ubuntuosversion')]", "version": "latest"}, "osdisk": {"name": "[concat(variables('vmname'),"_osdisk')]", "caching": "readwrite", "createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}}}{"type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(variables('vmname'),"/installospatching')]", "apiversion": "2019-12-01", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines/", variables('vmname'))]"], "properties": {"publisher": "microsoft.ostcextensions", "type": "ospatchingforlinux", "typehandlerversion": "2.0", "settings": {"disabled": false, "stop": false, "rebootafterpatch": "[parameters('rebootafterpatch')]", "category": "[parameters('category')]", "installduration": "[parameters('installduration')]", "oneoff": "[parameters('oneoff')]", "intervalofweeks": "1", "dayofweek": "[parameters('dayofweek')]", "starttime": "[parameters('starttime')]", "vmstatustest": {"local": false, "idletestscript": "[parameters('idletestscript')]", "healthytestscript": "[parameters('healthytestscript')]"}}, "protectedsettings": {"storageaccountname": "[parameters('storageaccountname')]", "storageaccountkey": "[listkeys(parameters('storageaccountresourceid'), "2021-04-01').keys[0].value]"}}} |
Showcase topologies available with dedicated hosts spanning fault domains and availability zones. | {"name": "[concat(parameters('dhgnameprefix'),copyindex())]", "type": "microsoft.compute/hostgroups", "apiversion": "2020-12-01", "location": "[parameters('location')]", "zones": "[if(equals(parameters('numberofzoness'), 0), json('null'),array(copyindex(1)))]", "copy": {"name": "[parameters('dhgnameprefix')]", "count": "[if(equals(parameters('numberofzoness'), 0), 1, parameters('numberofzoness'))]"}, "properties": {"platformfaultdomaincount": "[parameters('numberoffds')]"}}{"name": "[concat(parameters('dhgnameprefix'),div(copyindex(), parameters('numberofhostsperzone')),"/", parameters('dhnameprefix'),div(copyindex(), parameters('numberofhostsperzone')),mod(copyindex(), parameters('numberofhostsperzone')))]", "type": "microsoft.compute/hostgroups/hosts", "apiversion": "2018-10-01", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/hostgroups",parameters('dhgnameprefix'), copyindex(2))]"], "sku": {"name": "[parameters('dhsku')]"}, "copy": {"name": "[parameters('dhgnameprefix')]", "count": "[variables('numberofhosts')]"}, "properties": {"platformfaultdomain": "[mod(copyindex(), parameters('numberoffds'))]"}} |
This template deploys a VM Scale Set of Windows VMs with a jumpbox, enables encryption on VMSS. | {"type": "microsoft.compute/virtualmachines", "name": "[variables('jumpboxname')]", "location": "[parameters('location')]", "apiversion": "2017-03-30", "dependson": ["[variables('jumpboxnicname')]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsku')]"}, "osprofile": {"computername": "[variables('jumpboxname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": "[variables('imagereference')]", "osdisk": {"name": "[variables('jumpboxosdiskname')]", "caching": "readwrite", "createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('jumpboxnicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('jumpboxsaname')).primaryendpoints.blob]"}}}}{"type": "microsoft.compute/virtualmachinescalesets", "name": "[parameters('vmssname')]", "location": "[parameters('location')]", "apiversion": "2017-03-30", "dependson": ["[variables('virtualnetworkname')]"], "identity": {"type": "systemassigned"}, "sku": {"name": "[parameters('vmsku')]", "tier": "standard", "capacity": "[parameters('instancecount')]"}, "properties": {"overprovision": true, "upgradepolicy": {"mode": "automatic"}, "virtualmachineprofile": {"storageprofile": {"osdisk": {"createoption": "fromimage"}, "imagereference": "[variables('imagereference')]"}, "osprofile": {"computernameprefix": "[variables('naminginfix')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "[variables('nicname')]", "properties": {"primary": true, "ipconfigurations": [{"name": "[variables('ipconfigname')]", "properties": {"subnet": {"id": "[variables('subnetref')]"}}}]}}]}}}}{"type": "microsoft.compute/virtualmachinescalesets/extensions", "name": "[concat(parameters('vmssname'),"/diskencryption')]", "apiversion": "2019-03-01", "dependson": ["[resourceid('microsoft.keyvault/vaults", parameters('keyvaultname'))]"], "location": "[parameters('location')]", "properties": {"publisher": "microsoft.azure.security", "type": "azurediskencryption", "typehandlerversion": "2.2", "autoupgrademinorversion": true, "settings": {"encryptionoperation": "[variables('encryptionoperation')]", "keyvaulturl": "[variables('keyvaulturl')]", "keyvaultresourceid": "[variables('keyvaultresourceid')]", "volumetype": "all"}}} |
Setup or Update Existing SQL Server with Auto Backup | {"apiversion": "2021-07-01", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('existingvirtualmachinename'), "/sqliaasextension')]", "location": "[parameters('location')]", "properties": {"type": "sqliaasagent", "publisher": "microsoft.sqlserver.management", "typehandlerversion": "1.2", "autoupgrademinorversion": true, "settings": {"autobackupsettings": {"enable": true, "retentionperiod": "[parameters('sqlautobackupretentionperiod')]", "enableencryption": true}}, "protectedsettings": {"storageurl": "[reference(resourceid('microsoft.storage/storageaccounts", parameters('sqlautobackupstorageaccountname')), "2021-04-01').primaryendpoints["blob"]]", "storageaccesskey": "[listkeys(resourceid('microsoft.storage/storageaccounts", parameters('sqlautobackupstorageaccountname')), "2021-04-01').keys[0].value]", "password": "[parameters('sqlautobackupencryptionpassword')]"}}} |
This template takes a minimum amount of parameters and deploys an Image Version. | {"type": "microsoft.compute/galleries/images/versions", "apiversion": "2020-09-30", "name": "[concat(parameters('existinggalleryname'), "/", parameters('existinggalleryimagedefinitionname'), "/", parameters('galleryimageversionname'))]", "location": "[parameters('location')]", "properties": {"publishingprofile": {"replicacount": 1, "targetregions": [{"name": "[parameters('location')]"}]}, "storageprofile": {"source": {"id": "[parameters('existingmanagedimageid')]"}, "osdiskimage": {"hostcaching": "readwrite"}}}} |
This template deploys a Custom Linux Image behind a load balancer with HTTP load balancing rules and an update script for deploying and updating an app. | {"type": "microsoft.compute/images", "apiversion": "2020-06-01", "name": "[variables('imagename')]", "location": "[parameters('location')]", "properties": {"hypervgeneration": "v1", "storageprofile": {"osdisk": {"ostype": "linux", "osstate": "generalized", "bloburi": "[parameters('sourceimagevhduri')]", "storageaccounttype": "standard_lrs"}}}}{"type": "microsoft.compute/virtualmachinescalesets", "name": "[variables('vmssuniquename')]", "location": "[parameters('location')]", "apiversion": "2020-06-01", "dependson": ["[resourceid('microsoft.network/virtualnetworks", variables('virtualnetworkname'))]", "[resourceid('microsoft.compute/images",variables('imagename'))]"], "sku": {"name": "[parameters('vmsku')]", "tier": "standard", "capacity": "[parameters('capacity')]"}, "properties": {"upgradepolicy": {"mode": "manual"}, "virtualmachineprofile": {"storageprofile": {"imagereference": {"id": "[resourceid('microsoft.compute/images", variables('imagename'))]"}}, "osprofile": {"computernameprefix": "[variables('vmssuniquename')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "networkprofile": {"networkinterfaceconfigurations": [{"name": "[variables('nicname')]", "properties": {"primary": true, "ipconfigurations": [{"name": "[variables('ipconfigname')]", "properties": {"subnet": {"id": "[resourceid('microsoft.network/virtualnetworks/subnets", variables('virtualnetworkname'), variables('subnetname'))]"}, "loadbalancerbackendaddresspools": [{"id": "[resourceid('microsoft.network/loadbalancers/backendaddresspools", variables('lbname'), variables('bepoolname'))]"}], "loadbalancerinboundnatpools": [{"id": "[resourceid('microsoft.network/loadbalancers/inboundnatpools", variables('lbname'), variables('natpoolname'))]"}]}}]}}]}, "extensionprofile": {"extensions": [{"name": "updatescriptextension", "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": true, "settings": {"fileuris": ["[uri(parameters('_artifactslocation'), concat('scripts/updateapp.sh", parameters('_artifactslocationsastoken')))]", "[uri(parameters('_artifactslocation'), concat('app/package.tar.gz", parameters('_artifactslocationsastoken')))]"], "commandtoexecute": "[format(\"sudo bash {0} "{1}" {2} {3}\", \"updateapp.sh\", \"package.tar.gz\", \"/nodeserver\", \"mainsite.service\')]"}}}]}}}} |
Create VM from VHDs(OS+data disk) and connect it to an existing virtual network | {"type": "microsoft.compute/disks", "apiversion": "2017-03-30", "name": "[concat(parameters('vmname'), "_osdisk')]", "location": "[parameters('location')]", "properties": {"creationdata": {"createoption": "import", "sourceuri": "[parameters('osdiskvhduri')]"}, "ostype": "[parameters('ostype')]"}}{"type": "microsoft.compute/disks", "apiversion": "2017-03-30", "name": "[concat(parameters('vmname'), "_datadisk')]", "location": "[parameters('location')]", "properties": {"creationdata": {"createoption": "import", "sourceuri": "[parameters('datadisk0vhduri')]"}}}{"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "tags": {"displayname": "virtualmachine"}, "dependson": ["[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]", "[resourceid('microsoft.compute/disks", concat(parameters('vmname'), "_osdisk'))]", "[resourceid('microsoft.compute/disks", concat(parameters('vmname'), "_datadisk'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "storageprofile": {"osdisk": {"ostype": "[parameters('ostype')]", "caching": "readwrite", "createoption": "attach", "manageddisk": {"id": "[resourceid('microsoft.compute/disks", concat(parameters('vmname'), "_osdisk'))]"}}, "datadisks": [{"lun": 0, "manageddisk": {"id": "[resourceid('microsoft.compute/disks", concat(parameters('vmname'), "_datadisk'))]"}, "caching": "readonly", "createoption": "attach"}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('diagstorageaccountname'), "2021-02-01').primaryendpoints["blob"]]"}}}} |
Creates a new VM with two NICs which connect to two different subnets within the same VNet. | {"type": "microsoft.compute/virtualmachines", "apiversion": "2020-06-01", "name": "[variables('virtualmachinename')]", "location": "[parameters('location')]", "properties": {"osprofile": {"computername": "[variables('virtualmachinename')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]", "windowsconfiguration": {"provisionvmagent": true}}, "hardwareprofile": {"vmsize": "[parameters('virtualmachinesize')]"}, "storageprofile": {"imagereference": {"publisher": "microsoftwindowsserver", "offer": "windowsserver", "sku": "2019-datacenter", "version": "latest"}, "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"properties": {"primary": true}, "id": "[resourceid('microsoft.network/networkinterfaces", variables('nic1name'))]"}, {"properties": {"primary": false}, "id": "[resourceid('microsoft.network/networkinterfaces", variables('nic2name'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(resourceid('microsoft.storage/storageaccounts", variables('diagstorageaccountname'))).primaryendpoints.blob]"}}}, "dependson": ["[resourceid('microsoft.storage/storageaccounts", variables('diagstorageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces", variables('nic1name'))]", "[resourceid('microsoft.network/networkinterfaces", variables('nic2name'))]"]} |
Create a VM from a Windows Image with 4 Empty Data Disks | {"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts/", variables('storageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", variables('nicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[variables('imagesku')]", "version": "[variables('imageversion')]"}, "datadisks": [{"disksizegb": "[parameters('sizeofeachdatadiskingb')]", "lun": 0, "createoption": "empty"}, {"disksizegb": "[parameters('sizeofeachdatadiskingb')]", "lun": 1, "createoption": "empty"}, {"disksizegb": "[parameters('sizeofeachdatadiskingb')]", "lun": 2, "createoption": "empty"}, {"disksizegb": "[parameters('sizeofeachdatadiskingb')]", "lun": 3, "createoption": "empty"}], "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('storageaccountname'), "2019-06-01').primaryendpoints["blob"]]"}}}} |
Create a PowerBI Workspace Collection in Azure. | {"apiversion": "2016-01-29", "type": "microsoft.powerbi/workspacecollections", "name": "[parameters('powerbiworkspacename')]", "location": "[parameters('location')]", "sku": {"name": "[parameters('sku')]"}, "tags": {"objectname": "[parameters('powerbiworkspacename')]"}} |
This template creates an Azure Event Grid custom topic and a webhook subscription. Template originally authored by John Downs. | {"type": "microsoft.eventgrid/topics", "apiversion": "2020-06-01", "name": "[parameters('eventgridtopicname')]", "location": "[parameters('location')]"}{"type": "microsoft.eventgrid/eventsubscriptions", "apiversion": "2020-06-01", "scope": "[format('microsoft.eventgrid/topics/{0}", parameters('eventgridtopicname'))]", "name": "[parameters('eventgridsubscriptionname')]", "properties": {"destination": {"endpointtype": "webhook", "properties": {"endpointurl": "[parameters('eventgridsubscriptionurl')]"}}}, "dependson": ["[resourceid('microsoft.eventgrid/topics", parameters('eventgridtopicname'))]"]} |
This template creates an Azure Event Grid custom topic and a service bus queue subscription. Template originally authored by Markus Meyer. | {"type": "microsoft.eventgrid/topics", "apiversion": "2020-06-01", "name": "[parameters('eventgridtopicname')]", "location": "[parameters('location')]"}{"type": "microsoft.eventgrid/eventsubscriptions", "apiversion": "2020-06-01", "scope": "[format('microsoft.eventgrid/topics/{0}", parameters('eventgridtopicname'))]", "name": "[parameters('eventgridsubscriptionname')]", "properties": {"destination": {"endpointtype": "servicebusqueue", "properties": {"resourceid": "[resourceid('microsoft.servicebus/namespaces/queues", split(format('{0}/{1}", parameters('servicebusnamespacename'), parameters('servicebusqueuename')), "/')[0], split(format('{0}/{1}", parameters('servicebusnamespacename'), parameters('servicebusqueuename')), "/')[1])]"}}, "eventdeliveryschema": "eventgridschema", "filter": {"issubjectcasesensitive": false}}, "dependson": ["[resourceid('microsoft.eventgrid/topics", parameters('eventgridtopicname'))]", "[resourceid('microsoft.servicebus/namespaces/queues", split(format('{0}/{1}", parameters('servicebusnamespacename'), parameters('servicebusqueuename')), "/')[0], split(format('{0}/{1}", parameters('servicebusnamespacename'), parameters('servicebusqueuename')), "/')[1])]"]} |
This template creates an Azure Event Grid custom topic and Azure Event Hubs. The event subscription sends events from the custom topic to the event hub. | {"type": "microsoft.eventgrid/topics", "apiversion": "2020-06-01", "name": "[parameters('topicname')]", "location": "[parameters('location')]"}{"scope": "[format('microsoft.eventgrid/topics/{0}", parameters('topicname'))]", "type": "microsoft.eventgrid/eventsubscriptions", "apiversion": "2020-06-01", "name": "[parameters('subscriptionname')]", "dependson": ["[resourceid('microsoft.eventgrid/topics", parameters('topicname'))]", "[resourceid('microsoft.eventhub/namespaces/eventhubs", parameters('eventhubnamespace'), parameters('eventhubname'))]"], "properties": {"destination": {"endpointtype": "eventhub", "properties": {"resourceid": "[resourceid('microsoft.eventhub/namespaces/eventhubs", parameters('eventhubnamespace'), parameters('eventhubname'))]"}}, "filter": {"issubjectcasesensitive": false}}} |
This template creates a custom Azure Event Grid topic, a webhook subscription having CloudEvents schema, and a Logic App as an event handler. Template originally authored by Justin Yoo. | {"comments": "### resource - custom event grid topic ###", "apiversion": "2020-06-01", "type": "microsoft.eventgrid/topics", "name": "[variables('eventgridtopic').name]", "location": "[variables('eventgridtopic').location]", "tags": "[variables('tags')]", "properties": {"inputschema": "cloudeventv01schema"}}{"comments": "### resource - event grid subscription ###", "scope": "[format('microsoft.eventgrid/topics/{0}", variables('eventgridtopic').name)]", "type": "microsoft.eventgrid/eventsubscriptions", "apiversion": "2019-06-01", "name": "[variables('eventgridsubscription').name]", "location": "[variables('eventgridsubscription').location]", "tags": "[variables('tags')]", "dependson": ["[variables('logicapp').name]", "[variables('eventgridtopic').name]"], "properties": {"eventdeliveryschema": "cloudeventv01schema", "destination": {"endpointtype": "webhook", "properties": {"endpointurl": "[listcallbackurl(variables('logicapp').triggerid, "2019-05-01').value]"}}, "filter": {"issubjectcasesensitive": false}}} |
This template creates an Azure Event Grid custom topic and a service bus topic subscription. Template originally authored by Markus Meyer. | {"name": "[parameters('eventgridtopicname')]", "type": "microsoft.eventgrid/topics", "location": "[parameters('location')]", "apiversion": "2020-06-01", "dependson": ["[resourceid('microsoft.servicebus/namespaces", parameters('servicebusnamespacename'))]"]}{"scope": "[concat('microsoft.eventgrid/topics/", parameters('eventgridtopicname'))]", "type": "microsoft.eventgrid/eventsubscriptions", "name": "[parameters('eventgridsubscriptionname')]", "apiversion": "2020-01-01-preview", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.eventgrid/topics", parameters('eventgridtopicname'))]"], "properties": {"destination": {"endpointtype": "servicebustopic", "properties": {"resourceid": "[resourceid('microsoft.servicebus/namespaces/topics", parameters('servicebusnamespacename'), parameters('servicebustopicname'))]"}}, "eventdeliveryschema": "eventgridschema", "filter": {"issubjectcasesensitive": false}}} |
This template creates Azure Blob Storage account and then creates an Event Grid subscription to that Blob. | {"type": "microsoft.eventgrid/systemtopics", "apiversion": "2020-04-01-preview", "name": "[parameters('systemtopicname')]", "location": "[parameters('location')]", "dependson": ["[parameters('storagename')]"], "properties": {"source": "[resourceid('microsoft.storage/storageaccounts", parameters('storagename'))]", "topictype": "microsoft.storage.storageaccounts"}}{"type": "microsoft.eventgrid/systemtopics/eventsubscriptions", "apiversion": "2020-04-01-preview", "name": "[concat(parameters('systemtopicname'), "/", parameters('eventsubname'))]", "dependson": ["[resourceid('microsoft.eventgrid/systemtopics", parameters('systemtopicname'))]"], "properties": {"destination": {"properties": {"endpointurl": "[parameters('endpoint')]"}, "endpointtype": "webhook"}, "filter": {"includedeventtypes": ["microsoft.storage.blobcreated", "microsoft.storage.blobdeleted"]}}} |
This template creates an Azure Migrate project that will be used for discovering, assessing and migrating servers, apps, data | {"type": "microsoft.migrate/migrateprojects", "apiversion": "2020-05-01", "name": "[parameters('migrateprojectname')]", "location": "[parameters('location')]", "tags": {"migrate project": "[parameters('migrateprojectname')]"}, "properties": {}}{"type": "microsoft.migrate/migrateprojects/solutions", "apiversion": "2020-05-01", "name": "[concat(parameters('migrateprojectname'), "/servers-assessment-serverassessment')]", "dependson": ["[resourceid('microsoft.migrate/migrateprojects", parameters('migrateprojectname'))]"], "properties": {"tool": "serverassessment", "purpose": "assessment", "goal": "servers", "status": "active"}}{"type": "microsoft.migrate/migrateprojects/solutions", "apiversion": "2020-05-01", "name": "[concat(parameters('migrateprojectname'), "/servers-discovery-serverdiscovery')]", "dependson": ["[resourceid('microsoft.migrate/migrateprojects", parameters('migrateprojectname'))]"], "properties": {"tool": "serverdiscovery", "purpose": "discovery", "goal": "servers", "status": "inactive"}}{"type": "microsoft.migrate/migrateprojects/solutions", "apiversion": "2020-05-01", "name": "[concat(parameters('migrateprojectname'), "/servers-migration-servermigration')]", "dependson": ["[resourceid('microsoft.migrate/migrateprojects", parameters('migrateprojectname'))]"], "properties": {"tool": "servermigration", "purpose": "migration", "goal": "servers", "status": "active"}} |
This template creates a budget to track cost or usage and get notified whenever a specified threshold is met. There are multiple notification thresholds that are available to configure. | {"type": "microsoft.consumption/budgets", "apiversion": "2021-10-01", "name": "[parameters('budgetname')]", "properties": {"timeperiod": {"startdate": "[parameters('startdate')]", "enddate": "[parameters('enddate')]"}, "timegrain": "[parameters('timegrain')]", "amount": "[parameters('amount')]", "category": "cost", "notifications": {"notificationforexceededbudget1": {"enabled": true, "operator": "greaterthan", "threshold": "[parameters('firstthreshold')]", "contactemails": "[parameters('contactemails')]"}, "notificationforexceededbudget2": {"enabled": true, "operator": "greaterthan", "threshold": "[parameters('secondthreshold')]", "contactemails": "[parameters('contactemails')]"}}}} |
This template creates a budget to track cost or usage and get notified whenever a specified threshold is met. There are multiple notification thresholds that are available to configure. | {"type": "microsoft.consumption/budgets", "apiversion": "2021-10-01", "name": "[parameters('budgetname')]", "properties": {"timeperiod": {"startdate": "[parameters('startdate')]", "enddate": "[parameters('enddate')]"}, "timegrain": "[parameters('timegrain')]", "amount": "[parameters('amount')]", "category": "cost", "notifications": {"notificationforexceededbudget1": {"enabled": true, "operator": "greaterthan", "threshold": "[parameters('firstthreshold')]", "contactemails": "[parameters('contactemails')]"}, "notificationforexceededbudget2": {"enabled": true, "operator": "greaterthan", "threshold": "[parameters('secondthreshold')]", "contactemails": "[parameters('contactemails')]"}}, "filter": {"dimensions": {"name": "resourcegroupname", "operator": "in", "values": "[parameters('resourcegroupfiltervalues')]"}}}} |
This template creates a budget to track cost or usage and get notified whenever a specified threshold is met. There are multiple notification thresholds that are available to configure. | {"type": "microsoft.consumption/budgets", "apiversion": "2021-10-01", "name": "[parameters('budgetname')]", "properties": {"timeperiod": {"startdate": "[parameters('startdate')]", "enddate": "[parameters('enddate')]"}, "timegrain": "[parameters('timegrain')]", "amount": "[parameters('amount')]", "category": "cost", "notifications": {"notificationforexceededbudget1": {"enabled": true, "operator": "greaterthan", "threshold": "[parameters('firstthreshold')]", "contactemails": "[parameters('contactemails')]", "contactroles": "[parameters('contactroles')]", "contactgroups": "[parameters('contactgroups')]"}, "notificationforexceededbudget2": {"enabled": true, "operator": "greaterthan", "threshold": "[parameters('secondthreshold')]", "contactemails": "[parameters('contactemails')]", "contactroles": "[parameters('contactroles')]", "contactgroups": "[parameters('contactgroups')]"}}, "filter": {"and": [{"dimensions": {"name": "resourcegroupname", "operator": "in", "values": "[parameters('resourcegroupfiltervalues')]"}}, {"dimensions": {"name": "metercategory", "operator": "in", "values": "[parameters('metercategoryfiltervalues')]"}}]}}} |
Azure Synapse Proof-of-Concept | {"type": "microsoft.synapse/workspaces", "apiversion": "2019-06-01-preview", "name": "[variables('workspacename')]", "location": "[parameters('location')]", "identity": {"type": "systemassigned"}, "dependson": ["[variables('dlsname')]", "[variables('dlsfsname')]"], "properties": {"defaultdatalakestorage": {"accounturl": "[reference(variables('dlsname')).primaryendpoints.dfs]", "filesystem": "[variables('dlsfsname')]"}, "sqladministratorlogin": "[parameters('sqladministratorlogin')]", "sqladministratorloginpassword": "[parameters('sqladministratorloginpassword')]", "managedvirtualnetwork": "default"}, "resources": [{"condition": "[equals(parameters('allowallconnections'),"true')]", "type": "firewallrules", "apiversion": "2019-06-01-preview", "name": "allowall", "location": "[parameters('location')]", "dependson": ["[variables('workspacename')]"], "properties": {"startipaddress": "0.0.0.0", "endipaddress": "255.255.255.255"}}, {"type": "firewallrules", "apiversion": "2019-06-01-preview", "name": "allowallwindowsazureips", "location": "[parameters('location')]", "dependson": ["[variables('workspacename')]"], "properties": {"startipaddress": "0.0.0.0", "endipaddress": "0.0.0.0"}}, {"type": "managedidentitysqlcontrolsettings", "apiversion": "2019-06-01-preview", "name": "default", "location": "[parameters('location')]", "dependson": ["[variables('workspacename')]"], "properties": {"grantsqlcontroltomanagedidentity": {"desiredstate": "enabled"}}}]}{"type": "microsoft.synapse/workspaces/sqlpools", "apiversion": "2019-06-01-preview", "name": "[concat(variables('workspacename'), "/", variables('sqlpoolname'))]", "location": "[parameters('location')]", "sku": {"name": "[parameters('sku')]"}, "dependson": ["[variables('workspacename')]"], "properties": {"createmode": "default", "collation": "sql_latin1_general_cp1_ci_as"}, "resources": [{"condition": "[parameters('metadatasync')]", "type": "metadatasync", "apiversion": "2019-06-01-preview", "name": "config", "location": "[parameters('location')]", "dependson": ["[variables('sqlpoolname')]"], "properties": {"enabled": "[parameters('metadatasync')]"}}]}{"condition": "[equals(parameters('sparkdeployment'),"true')]", "type": "microsoft.synapse/workspaces/bigdatapools", "apiversion": "2019-06-01-preview", "name": "[concat(variables('workspacename'), "/", variables('sparkpoolname'))]", "location": "[parameters('location')]", "dependson": ["[variables('workspacename')]"], "properties": {"nodecount": 5, "nodesizefamily": "memoryoptimized", "nodesize": "[parameters('sparknodesize')]", "autoscale": {"enabled": true, "minnodecount": 3, "maxnodecount": 40}, "autopause": {"enabled": true, "delayinminutes": 15}, "sparkversion": "2.4"}} |
This template configures Service Bus Geo-disaster recovery alias on premium SKU Namespaces. | {"apiversion": "2018-01-01-preview", "name": "[parameters('servicebusnamespacenamesecondary')]", "type": "microsoft.servicebus/namespaces", "location": "[parameters('locationsecondarynamepsace')]", "sku": {"name": "premium", "tier": "premium", "capacity": 4}, "tags": {"tag1": "value1", "tag2": "value2"}}{"apiversion": "2018-01-01-preview", "type": "microsoft.servicebus/namespaces", "dependson": ["[resourceid('microsoft.servicebus/namespaces", parameters('servicebusnamespacenamesecondary'))]"], "name": "[parameters('servicebusnamespacenameprimary')]", "location": "[parameters('location')]", "sku": {"name": "premium", "tier": "premium", "capacity": 4}, "tags": {"tag1": "value1", "tag2": "value2"}, "resources": [{"apiversion": "2017-04-01", "name": "[parameters('aliasname')]", "type": "disasterrecoveryconfigs", "dependson": ["[resourceid('microsoft.servicebus/namespaces", parameters('servicebusnamespacenameprimary'))]"], "properties": {"partnernamespace": "[resourceid('microsoft.servicebus/namespaces", parameters('servicebusnamespacenamesecondary'))]"}}]} |
This template creates a Service Bus Basic/Standard namespace. | {"apiversion": "2018-01-01-preview", "name": "[parameters('servicebusnamespacename')]", "type": "microsoft.servicebus/namespaces", "location": "[parameters('location')]", "sku": {"name": "[parameters('servicebussku')]"}, "properties": {}} |
This template deploys a Service Bus namespace, a topic, and a subscription. | {"apiversion": "2018-01-01-preview", "name": "[parameters('servicebusnamespacename')]", "type": "microsoft.servicebus/namespaces", "location": "[parameters('location')]", "sku": {"name": "standard", "tier": "standard"}, "resources": [{"apiversion": "2017-04-01", "name": "[parameters('servicebustopicname1')]", "type": "topics", "dependson": ["[resourceid('microsoft.servicebus/namespaces/", parameters('servicebusnamespacename'))]"], "properties": {"path": "[parameters('servicebustopicname1')]"}}, {"apiversion": "2017-04-01", "name": "[parameters('servicebustopicname2')]", "type": "topics", "dependson": ["[resourceid('microsoft.servicebus/namespaces/", parameters('servicebusnamespacename'))]"], "properties": {"path": "[parameters('servicebustopicname2')]"}, "resources": [{"apiversion": "2017-04-01", "name": "[parameters('servicebussubscriptionname')]", "type": "subscriptions", "dependson": ["[parameters('servicebustopicname1')]", "[parameters('servicebustopicname2')]"], "properties": {"forwardto": "[parameters('servicebustopicname1')]", "forwarddeadletteredmessagesto": "[parameters('servicebustopicname1')]"}}]}]} |
This template creates a Service Bus namespace and 2 queues and sets auto forwarding. | {"apiversion": "2017-04-01", "name": "[parameters('servicebusnamespacename')]", "type": "microsoft.servicebus/namespaces", "location": "[parameters('location')]", "sku": {"name": "standard"}, "properties": {}, "resources": [{"apiversion": "2017-04-01", "name": "[parameters('servicebusqueuename1')]", "type": "queues", "dependson": ["[resourceid('microsoft.servicebus/namespaces", parameters('servicebusnamespacename'))]"], "properties": {"lockduration": "pt5m", "maxsizeinmegabytes": "1024", "requiresduplicatedetection": "false", "requiressession": "false", "defaultmessagetimetolive": "p10675199dt2h48m5.4775807s", "deadletteringonmessageexpiration": "false", "duplicatedetectionhistorytimewindow": "pt10m", "maxdeliverycount": "10", "autodeleteonidle": "p10675199dt2h48m5.4775807s", "enablepartitioning": "false", "enableexpress": "false"}}, {"apiversion": "2017-04-01", "name": "[parameters('servicebusqueuename2')]", "type": "queues", "dependson": ["[resourceid('microsoft.servicebus/namespaces", parameters('servicebusnamespacename'))]", "[resourceid('microsoft.servicebus/namespaces/queues/", parameters('servicebusnamespacename'),parameters('servicebusqueuename1'))]"], "properties": {"lockduration": "pt5m", "maxsizeinmegabytes": "1024", "requiresduplicatedetection": "false", "requiressession": "false", "defaultmessagetimetolive": "p10675199dt2h48m5.4775807s", "deadletteringonmessageexpiration": "false", "duplicatedetectionhistorytimewindow": "pt10m", "maxdeliverycount": "10", "autodeleteonidle": "p10675199dt2h48m5.4775807s", "enablepartitioning": "false", "enableexpress": "false", "forwardto": "[parameters('servicebusqueuename1')]", "forwarddeadletteredmessagesto": "[parameters('servicebusqueuename1')]"}}]} |
This template creates a Service Bus Namespace and Topic with a Subscription that has a SQL Filter defined. | {"apiversion": "2018-01-01-preview", "name": "[parameters('servicebusnamespacename')]", "type": "microsoft.servicebus/namespaces", "location": "[parameters('location')]", "resources": [{"apiversion": "2017-04-01", "name": "[parameters('servicebustopicname')]", "type": "topics", "dependson": ["[resourceid('microsoft.servicebus/namespaces/", parameters('servicebusnamespacename'))]"], "properties": {"path": "[parameters('servicebustopicname')]"}, "resources": [{"apiversion": "2017-04-01", "name": "[parameters('servicebustopicsubscriptionname')]", "type": "subscriptions", "dependson": ["[parameters('servicebustopicname')]"], "resources": [{"apiversion": "2017-04-01", "name": "[concat(parameters('servicebustopicsubscriptionname'), "-filter')]", "type": "rules", "dependson": ["[parameters('servicebustopicsubscriptionname')]"], "properties": {"filter": {"sqlexpression": "[parameters('servicebustopicsubscriptionsqlfilter')]"}}}]}]}]} |
This template creates a Service Bus namespace and virtual network rule | {"type": "microsoft.servicebus/namespaces", "apiversion": "2017-04-01", "name": "[parameters('servicebusnamespacename')]", "location": "[parameters('location')]", "sku": {"name": "premium", "tier": "premium"}, "properties": {}}{"type": "microsoft.servicebus/namespaces/virtualnetworkrules", "apiversion": "2018-01-01-preview", "name": "[format('{0}/{1}", parameters('servicebusnamespacename'), parameters('vnetrulename'))]", "properties": {"virtualnetworksubnetid": "[resourceid('microsoft.network/virtualnetworks/subnets", format('{0}-vn", parameters('vnetrulename')), parameters('subnetname'))]"}, "dependson": ["[resourceid('microsoft.servicebus/namespaces", parameters('servicebusnamespacename'))]", "[resourceid('microsoft.network/virtualnetworks", format('{0}-vn", parameters('vnetrulename')))]"]} |
This template deploys a Service Bus namespace, a topic, and a subscription. | {"apiversion": "2018-01-01-preview", "name": "[parameters('service_busnamespace_name')]", "type": "microsoft.servicebus/namespaces", "location": "[parameters('location')]", "sku": {"name": "standard"}, "properties": {}, "resources": [{"apiversion": "2017-04-01", "name": "[parameters('servicebustopicname')]", "type": "topics", "dependson": ["[resourceid('microsoft.servicebus/namespaces/", parameters('service_busnamespace_name'))]"], "properties": {"defaultmessagetimetolive": "p10675199dt2h48m5.4775807s", "maxsizeinmegabytes": 1024, "requiresduplicatedetection": false, "duplicatedetectionhistorytimewindow": "pt10m", "enablebatchedoperations": false, "supportordering": false, "autodeleteonidle": "p10675199dt2h48m5.4775807s", "enablepartitioning": false, "enableexpress": false}, "resources": [{"apiversion": "2017-04-01", "name": "[parameters('servicebussubscriptionname')]", "type": "subscriptions", "dependson": ["[parameters('servicebustopicname')]"], "properties": {"lockduration": "pt1m", "requiressession": false, "defaultmessagetimetolive": "p10675199dt2h48m5.4775807s", "deadletteringonmessageexpiration": false, "maxdeliverycount": 10, "enablebatchedoperations": false, "autodeleteonidle": "p10675199dt2h48m5.4775807s"}}]}]} |