MihaiIonascu/Azure_IaC_test huggingface dataset:
Create a VM from a Windows Image with 4 Empty Data Disks

{"apiversion": "2015-06-15", "type": "microsoft.compute/availabilitysets", "name": "[variables('ossavailabilitysetsettings').name]", "location": "[parameters('location')]", "sku": {"name": "aligned"}, "properties": {"platformfaultdomaincount": "[variables('ossavailabilitysetsettings').faultdomaincount]", "platformupdatedomaincount": "[variables('ossavailabilitysetsettings').updatedomaincount]"}}{"apiversion": "2017-03-30", "type": "microsoft.compute/virtualmachines", "name": "[concat(parameters('vmnameprefix'),"mgs')]", "plan": {"publisher": "intel", "product": "lustre-cloud-edition-gs-image", "name": "eval-lustre-2-7"}, "location": "[parameters('location')]", "dependson": ["storageaccountscopy", "[concat('microsoft.network/networkinterfaces/", parameters('vmnameprefix'), "mgs')]"], "tags": {"lustretype": "mgt"}, "properties": {"hardwareprofile": {"vmsize": "[parameters('mgsvmsize')]"}, "osprofile": {"computername": "[concat(parameters('vmnameprefix'),"mgs')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]", "linuxconfiguration": "[variables('linuxconfiguration')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagereferencelustre').publisher]", "offer": "[variables('imagereferencelustre').offer]", "sku": "[variables('imagereferencelustre').sku]", "version": "latest"}, "osdisk": {"name": "[concat(parameters('vmnameprefix'),"mgs","_osdisk')]", "caching": "readwrite", "createoption": "fromimage"}, "datadisks": [{"name": "[concat(parameters('vmnameprefix'),"mgs","_datadisk1')]", "disksizegb": 5, "lun": 0, "caching": "none", "createoption": "empty"}, {"name": "[concat(parameters('vmnameprefix'),"mgs","_datadisk2')]", "disksizegb": 16, "lun": 1, "caching": "none", "createoption": "empty"}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",concat(parameters('vmnameprefix'),"mgs'))]"}]}}}{"apiversion": "2015-06-15", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmnameprefix'), "mgs", "/init')]", "location": "[parameters('location')]", "dependson": ["[concat('microsoft.compute/virtualmachines/", concat(parameters('vmnameprefix'), "mgs'))]"], "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": true, "settings": {"fileuris": ["[variables('scripturllustre')]"], "commandtoexecute": "[concat('sh lustre.sh", " -n mgs", " -i 0", " -d ", variables('mgsdiskcount'), " -m ", reference(resourceid('microsoft.network/networkinterfaces", concat(parameters('vmnameprefix'), "mgs'))).ipconfigurations[0].properties.privateipaddress, " -l ", reference(resourceid('microsoft.network/networkinterfaces", concat(parameters('vmnameprefix'), "mgs'))).ipconfigurations[0].properties.privateipaddress, " -f ", parameters('filesystemname'))]"}}}
This module creates a storageAccount resource with apiVersion 2021-01-01.

{"type": "microsoft.storage/storageaccounts", "apiversion": "2019-06-01", "name": "[variables('storageaccountname')]", "location": "[parameters('existingvnetlocation')]", "dependson": ["[resourceid(parameters('existingdatafactoryresourcegroup'), "microsoft.resources/deployments", "nestedtemplate')]"], "sku": {"name": "standard_lrs"}, "kind": "storage", "properties": {}}
Create a VM from a Windows Image with 4 Empty Data Disks

{"type": "microsoft.compute/virtualmachines", "apiversion": "2019-07-01", "name": "vslab", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts", variables('storagename'))]", "[resourceid('microsoft.network/networkinterfaces", "vslab-nic')]"], "tags": {"displayname": "vs2019 lab vm"}, "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "labvm", "adminusername": "[parameters('adminuser')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "microsoftvisualstudio", "offer": "visualstudio", "sku": "vs-2017-comm-latest-ws2016", "version": "latest"}, "osdisk": {"name": "labvmosdisk", "caching": "readwrite", "createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", "vslab-nic')]"}]}}}
Storage Account with Storage Service Encryption and a blob deletion retention policy

{"type": "microsoft.storage/storageaccounts", "apiversion": "2021-04-01", "name": "[variables('supportlogstorageaccountname')]", "location": "[parameters('location')]", "sku": {"name": "standard_lrs"}, "kind": "storage", "tags": {"resourcetype": "service fabric", "clustername": "[parameters('clustername')]"}, "properties": {}}
Create a VM from a Windows Image with 4 Empty Data Disks

{"type": "microsoft.compute/availabilitysets", "name": "[variables('avsetnamedb')]", "apiversion": "2020-12-01", "location": "[parameters('location')]", "sku": {"name": "aligned"}, "properties": {"platformfaultdomaincount": 2, "platformupdatedomaincount": 20}}{"type": "microsoft.compute/virtualmachines", "name": "[concat(variables('vmnamedb'), "-", copyindex())]", "copy": {"name": "dbvmloop", "count": "[variables('dbvmcount')]"}, "dependson": ["dbnicloop", "[resourceid('microsoft.compute/availabilitysets/", variables('avsetnamedb'))]"], "apiversion": "2020-12-01", "location": "[parameters('location')]", "properties": {"availabilityset": {"id": "[resourceid('microsoft.compute/availabilitysets", variables('avsetnamedb'))]"}, "hardwareprofile": {"vmsize": "[variables('sizes')[parameters('sapsystemsize')][parameters('dbtype')].vmsize]"}, "osprofile": {"computername": "[concat(variables('vmnamedb'), "-", copyindex())]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": {"publisher": "[variables('images')[parameters('ostype')].publisher]", "offer": "[variables('images')[parameters('ostype')].offer]", "sku": "[variables('images')[parameters('ostype')].sku]", "version": "latest"}, "osdisk": {"name": "[concat(variables('vmnamedb'), "-", copyindex(), "-osdisk')]", "caching": "readwrite", "createoption": "fromimage", "disksizegb": "[variables('images')[parameters('ostype')].osdisksize]", "manageddisk": {"storageaccounttype": "premium_lrs"}}, "datadisks": "[variables('sizes')[parameters('sapsystemsize')][parameters('dbtype')].disks]"}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", concat(variables('nicnamedb'), "-", copyindex()))]"}]}}}
Storage Account with Storage Service Encryption and a blob deletion retention policy

{"type": "microsoft.storage/storageaccounts", "name": "[variables('storageaccountname')]", "apiversion": "2021-02-01", "location": "[parameters('location')]", "sku": {"name": "[variables('storageaccounttype')]"}}
Storage Account with Storage Service Encryption and a blob deletion retention policy

{"type": "microsoft.storage/storageaccounts", "name": "[variables('defaultstorageaccount').name]", "location": "[parameters('location')]", "apiversion": "2021-04-01", "sku": {"name": "[variables('defaultstorageaccount').type]"}, "kind": "storage", "properties": {}}
This module creates a key resource in an existing KeyVault with apiVersion 2019-09-01.

{"type": "microsoft.keyvault/vaults", "apiversion": "2019-09-01", "name": "[variables('key_vault_name')]", "location": "[parameters('location')]", "properties": {"enabledfordeployment": true, "enabledfordiskencryption": false, "enabledfortemplatedeployment": true, "enablesoftdelete": false, "tenantid": "[variables('tenantid')]", "accesspolicies": [{"objectid": "[parameters('keyvaultownerid')]", "tenantid": "[variables('tenantid')]", "permissions": {"keys": "[variables('keyspermissions')]", "secrets": "[variables('secretspermissions')]"}}], "sku": {"name": "[variables('skuname')]", "family": "a"}, "networkacls": {"defaultaction": "allow", "bypass": "azureservices"}}}{"type": "microsoft.keyvault/vaults/secrets", "apiversion": "2019-09-01", "name": "[concat(variables('key_vault_name'), "/", variables('key_vault_secretname_sasinst'))]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.keyvault/vaults", variables('key_vault_name'))]"], "properties": {"value": "[parameters('sasinternalpassword')]"}}{"type": "microsoft.keyvault/vaults/secrets", "apiversion": "2019-09-01", "name": "[concat(variables('key_vault_name'), "/", variables('key_vault_secretname_sasext'))]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.keyvault/vaults", variables('key_vault_name'))]"], "properties": {"value": "[parameters('sasexternalpassword')]"}}
This template uses Azure Managed Identity to assign access to Azure Maps. See more at https://aka.ms/amauth

{"condition": "[parameters('enabledeletelock')]", "type": "microsoft.authorization/locks", "apiversion": "2017-04-01", "scope": "[format('microsoft.operationalinsights/workspaces/{0}", parameters('name'))]", "name": "[variables('lockname')]", "properties": {"level": "cannotdelete"}, "dependson": ["[resourceid('microsoft.operationalinsights/workspaces", parameters('name'))]"]}
Establish connection to a VNET via an ExpressRoute circuit

{"apiversion": "2020-05-01", "type": "microsoft.network/publicipaddresses", "name": "[variables('publicipaddressname')]", "location": "[parameters('location')]", "sku": {"name": "standard"}, "properties": {"publicipallocationmethod": "static", "dnssettings": {"domainnamelabel": "[parameters('dnsname')]"}}}{"apiversion": "2020-05-01", "type": "microsoft.network/networksecuritygroups", "name": "[variables('networksecuritygroupname')]", "location": "[parameters('location')]", "properties": {"securityrules": [{"name": "remoteconnection", "properties": {"description": "allow rdp/ssh", "protocol": "tcp", "sourceportrange": "*", "destinationportrange": "[if(equals(parameters('windowsorubuntu'), "windows'), 3389, 22)]", "sourceaddressprefix": "*", "destinationaddressprefix": "*", "access": "allow", "priority": 100, "direction": "inbound"}}]}}
This template disables data disk encryption on a running Linux VM which was encrypted without AAD

{"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')]"}}}
Storage Account with Storage Service Encryption and a blob deletion retention policy

{"type": "microsoft.storage/storageaccounts", "name": "[variables('storageaccountname')]", "apiversion": "2017-06-01", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/virtualnetworks/", parameters('vnetname'))]"], "sku": {"name": "[parameters('storageaccounttype')]"}, "kind": "storage", "properties": {"networkacls": {"bypass": "none", "virtualnetworkrules": [{"id": "[variables('subnetid')[0]]", "action": "allow"}], "defaultaction": "deny"}}}
Deploy an Azure Databricks workspace with a custom virtual network.

{"comments": "the resource group specified will be locked after deployment.", "type": "microsoft.databricks/workspaces", "apiversion": "2018-04-01", "name": "[parameters('workspacename')]", "location": "[parameters('location')]", "sku": {"name": "[parameters('pricingtier')]"}, "properties": {"managedresourcegroupid": "[variables('managedresourcegroupid')]", "parameters": {"customvirtualnetworkid": {"value": "[parameters('customvirtualnetworkid')]"}, "custompublicsubnetname": {"value": "[parameters('custompublicsubnetname')]"}, "customprivatesubnetname": {"value": "[parameters('customprivatesubnetname')]"}, "enablenopublicip": {"value": "[parameters('disablepublicip')]"}}}}
Storage Account with Storage Service Encryption and a blob deletion retention policy

{"type": "microsoft.storage/storageaccounts", "name": "[parameters('vmdiagnosticsstorageaccountname')]", "apiversion": "2021-01-01", "location": "[parameters('location')]", "sku": {"name": "[variables('storatetype')]"}}
Storage Account with Storage Service Encryption and a blob deletion retention policy

{"type": "microsoft.storage/storageaccounts", "name": "[parameters('storagename')]", "apiversion": "2021-01-01", "location": "[parameters('location')]", "sku": {"name": "[parameters('storagetype')]"}}
Establish connection to a VNET via an ExpressRoute circuit

{"apiversion": "2020-08-01", "type": "microsoft.network/networksecuritygroups", "name": "[variables('securitygroupname')]", "location": "[parameters('location')]", "properties": {"securityrules": [{"name": "ssh", "properties": {"description": "allows ssh traffic", "protocol": "tcp", "sourceportrange": "*", "destinationportrange": "22", "sourceaddressprefix": "*", "destinationaddressprefix": "*", "access": "allow", "priority": 100, "direction": "inbound"}}]}}{"apiversion": "2015-06-15", "type": "microsoft.network/virtualnetworks", "name": "[parameters('virtualnetworkname')]", "location": "[parameters('location')]", "properties": {"addressspace": {"addressprefixes": ["[parameters('addressprefix')]"]}, "subnets": [{"name": "[parameters('subnet1name')]", "properties": {"addressprefix": "[parameters('subnet1prefix')]"}}]}}{"apiversion": "2020-08-01", "type": "microsoft.network/publicipaddresses", "name": "publicip", "location": "[parameters('location')]", "properties": {"publicipallocationmethod": "dynamic", "dnssettings": {"domainnamelabel": "[parameters('dnsname')]"}}}{"apiversion": "2015-06-15", "type": "microsoft.network/networkinterfaces", "name": "nic", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/virtualnetworks/", parameters('virtualnetworkname'))]", "[resourceid('microsoft.network/publicipaddresses/", "publicip')]", "[resourceid('microsoft.network/networksecuritygroups/", variables('securitygroupname'))]"], "properties": {"ipconfigurations": [{"name": "ipconfig1", "properties": {"privateipallocationmethod": "dynamic", "publicipaddress": {"id": "[resourceid('microsoft.network/publicipaddresses", "publicip')]"}, "subnet": {"id": "[variables('subnet1ref')]"}}}], "networksecuritygroup": {"id": "[resourceid('microsoft.network/networksecuritygroups", variables('securitygroupname'))]"}}}
This template deploys a Disk pool into an exsisting vnet.

{"type": "microsoft.storagepool/diskpools", "apiversion": "2021-08-01", "name": "[parameters('diskpoolname')]", "sku": {"name": "[parameters('diskpoolsku')]"}, "location": "[parameters('diskpoollocation')]", "properties": {"availabilityzones": ["[parameters('diskpoolavailabilityzone')]"], "subnetid": "[variables('subnetid')]", "disks": [{"id": "[variables('diskid')]"}]}}{"type": "microsoft.storagepool/diskpools/iscsitargets", "apiversion": "2021-08-01", "name": "[format('{0}/{1}", parameters('diskpoolname'), parameters('targetname'))]", "properties": {"targetiqn": "iqn.2021-04.org.microsoft.com:target", "aclmode": "dynamic", "luns": [{"manageddiskazureresourceid": "[variables('diskid')]", "name": "lun0"}]}, "dependson": ["[resourceid('microsoft.storagepool/diskpools", parameters('diskpoolname'))]"]}
Establish connection to a VNET via an ExpressRoute circuit

{"type": "microsoft.network/publicipaddresses", "apiversion": "2019-11-01", "name": "vslab-publicip", "location": "[parameters('location')]", "tags": {"displayname": "publicipaddress"}, "properties": {"publicipallocationmethod": "dynamic", "dnssettings": {"domainnamelabel": "[variables('vm-dns')]"}}}{"type": "microsoft.network/networksecuritygroups", "apiversion": "2020-04-01", "name": "vslab-nsg", "location": "[parameters('location')]", "properties": {"securityrules": [{"name": "nsgrule1", "properties": {"description": "description", "protocol": "tcp", "sourceportrange": "*", "destinationportrange": "3389", "sourceaddressprefix": "*", "destinationaddressprefix": "*", "access": "allow", "priority": 100, "direction": "inbound"}}]}}{"type": "microsoft.network/virtualnetworks", "apiversion": "2020-04-01", "name": "vslab-virtualnetwork", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networksecuritygroups", "vslab-nsg')]"], "tags": {"displayname": "vslab-virtualnetwork"}, "properties": {"addressspace": {"addressprefixes": ["10.0.0.0/16"]}, "subnets": [{"name": "vslab-vnet-subnet", "properties": {"addressprefix": "10.0.0.0/24", "networksecuritygroup": {"id": "[resourceid('microsoft.network/networksecuritygroups", "vslab-nsg')]"}}}]}}
Create a VM from a Windows Image with 4 Empty Data Disks

{"type": "microsoft.compute/virtualmachines", "apiversion": "2019-07-01", "name": "[parameters('vm_name')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces", parameters('nic_name'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('vmimagepublisher')]", "offer": "[variables('vmimageoffer')]", "sku": "[variables('sku')]", "version": "latest"}, "osdisk": {"ostype": "windows", "name": "[concat(parameters('vm_name'), "_osdisk')]", "createoption": "fromimage", "caching": "readwrite"}}, "osprofile": {"computername": "[parameters('vm_name')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", parameters('nic_name'))]"}]}}}{"name": "[concat(parameters('vm_name'),"/gpudrivers')]", "type": "microsoft.compute/virtualmachines/extensions", "location": "[parameters('location')]", "apiversion": "2019-07-01", "dependson": ["[resourceid('microsoft.compute/virtualmachines/", parameters('vm_name'))]", "[resourceid('microsoft.compute/virtualmachines/extensions", parameters('vm_name'), "setupchocolatey')]"], "tags": {"displayname": "gpu-nvidia-drivers"}, "properties": {"publisher": "microsoft.hpccompute", "type": "nvidiagpudriverwindows", "typehandlerversion": "1.2", "autoupgrademinorversion": true}}{"name": "[concat(parameters('vm_name'),"/setupchocolatey')]", "apiversion": "2019-07-01", "type": "microsoft.compute/virtualmachines/extensions", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines/", parameters('vm_name'))]"], "tags": {"displayname": "config-choco"}, "properties": {"publisher": "microsoft.compute", "type": "customscriptextension", "typehandlerversion": "1.10", "autoupgrademinorversion": true, "settings": {"fileuris": ["[variables('setupscriptlocation')]"], "commandtoexecute": "[concat('powershell -executionpolicy bypass -file ", parameters('setupchocolateyscriptfilename')," -chocopackages ",parameters('chocopackages'))]"}}}
This sample contains a script to easily migrate template gallery templates to templateSpec resources.

{"name": "provisionconfiguration", "type": "microsoft.resources/deployments", "apiversion": "2018-02-01", "properties": {"mode": "incremental", "templatelink": {"uri": "[variables('provisionconfigurationurl')]", "contentversion": "1.0.0.0"}, "parameters": {"_artifactslocation": {"value": "[parameters('_artifactslocation')]"}, "_artifactslocationsastoken": {"value": "[parameters('_artifactslocationsastoken')]"}, "automationaccountname": {"value": "[variables('automationaccountname')]"}, "location": {"value": "[parameters('location')]"}, "compilename": {"value": "[parameters('compilename')]"}}}}{"name": "provisionnetwork", "type": "microsoft.resources/deployments", "apiversion": "2018-02-01", "properties": {"mode": "incremental", "templatelink": {"uri": "[variables('provisionnetworkurl')]", "contentversion": "1.0.0.0"}, "parameters": {"location": {"value": "[parameters('location')]"}, "virtualnetworkname": {"value": "[variables('virtualnetworkname')]"}, "virtualnetworkaddressrange": {"value": "[parameters('virtualnetworkaddressrange')]"}, "virtualnetworksubnets": {"value": "[variables('virtualnetworksubnets')]"}, "publicipaddressname": {"value": "[variables('publicipaddressname')]"}, "publicipaddresstype": {"value": "[variables('publicipaddresstype')]"}, "loadbalancername": {"value": "[variables('loadbalancername')]"}}}}{"name": "provisionserver", "type": "microsoft.resources/deployments", "apiversion": "2018-02-01", "dependson": ["provisionnetwork", "provisionconfiguration"], "properties": {"mode": "incremental", "templatelink": {"uri": "[variables('provisionserverurl')]", "contentversion": "1.0.0.0"}, "parameters": {"location": {"value": "[parameters('location')]"}, "vmssname": {"value": "[parameters('vmssname')]"}, "instancecount": {"value": "[parameters('instancecount')]"}, "vmsize": {"value": "[parameters('vmsize')]"}, "adminusername": {"value": "[parameters('adminusername')]"}, "adminpassword": {"value": "[parameters('adminpassword')]"}, "nicname": {"value": "[variables('nicname')]"}, "virtualnetworkname": {"value": "[variables('virtualnetworkname')]"}, "subnetname": {"value": "[variables('virtualnetworksubnetname')]"}, "loadbalancername": {"value": "[variables('loadbalancername')]"}, "automationaccountname": {"value": "[variables('automationaccountname')]"}}}}
This module creates a Shared Image Gallery resource with apiVersion 2019-12-01.

{"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('adminusername')]", "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": "[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'),"/newuserscript')]", "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/install_postgresql.sh", parameters('_artifactslocationsastoken')))]"], "commandtoexecute": "bash install_postgresql.sh"}}}
This sample contains a script to easily migrate template gallery templates to templateSpec resources.

{"type": "microsoft.resources/deployments", "apiversion": "2020-10-01", "dependson": ["microsoft.resources/deployments/networktemplate"], "name": "dbtemplate", "properties": {"mode": "incremental", "parameters": {"maharacommon": {"value": "[variables('maharacommon')]"}, "lbpubip": {"value": "[reference('networktemplate').outputs.lbpubip.value]"}, "ctlrpubip": {"value": "[reference('networktemplate').outputs.ctlrpubip.value]"}, "dbloginpassword": {"value": "[parameters('dbloginpassword')]"}}, "templatelink": {"uri": "[concat(variables('maharacommon').basetemplateurl, parameters('dbservertype'), ".json", parameters('_artifactslocationsastoken'))]"}}}{"condition": "[parameters('azurebackupswitch')]", "type": "microsoft.resources/deployments", "apiversion": "2020-10-01", "name": "recoverytemplate", "properties": {"mode": "incremental", "parameters": {"maharacommon": {"value": "[variables('maharacommon')]"}}, "templatelink": {"uri": "[concat(variables('maharacommon').basetemplateurl,"recoveryservices.json",parameters('_artifactslocationsastoken'))]"}}}{"type": "microsoft.resources/deployments", "apiversion": "2020-10-01", "name": "networktemplate", "properties": {"mode": "incremental", "parameters": {"maharacommon": {"value": "[variables('maharacommon')]"}}, "templatelink": {"uri": "[concat(variables('maharacommon').basetemplateurl,"network.json",parameters('_artifactslocationsastoken'))]"}}}
Establish connection to a VNET via an ExpressRoute circuit

{"apiversion": "2015-06-15", "type": "microsoft.network/publicipaddresses", "name": "[variables('publicipaddressname')]", "location": "[parameters('location')]", "properties": {"publicipallocationmethod": "[variables('publicipaddresstype')]", "dnssettings": {"domainnamelabel": "[parameters('dnslabelprefix')]"}}}{"comments": "default network security group for template", "type": "microsoft.network/networksecuritygroups", "apiversion": "2019-08-01", "name": "[variables('networksecuritygroupname')]", "location": "[parameters('location')]", "properties": {"securityrules": [{"name": "default-allow-22", "properties": {"priority": 1000, "access": "allow", "direction": "inbound", "destinationportrange": "22", "protocol": "tcp", "sourceaddressprefix": "*", "sourceportrange": "*", "destinationaddressprefix": "*"}}]}}{"apiversion": "2015-06-15", "type": "microsoft.network/virtualnetworks", "name": "[variables('virtualnetworkname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networksecuritygroups", variables('networksecuritygroupname'))]"], "properties": {"addressspace": {"addressprefixes": ["[variables('addressprefix')]"]}, "subnets": [{"name": "[variables('subnet1name')]", "properties": {"addressprefix": "[variables('subnet1prefix')]", "networksecuritygroup": {"id": "[resourceid('microsoft.network/networksecuritygroups", variables('networksecuritygroupname'))]"}}}]}}
Create a SQL Server Virtual Machine with performance optimized storage settings on PremiumSSD

{"type": "microsoft.sqlvirtualmachine/sqlvirtualmachines", "apiversion": "2017-03-01-preview", "name": "[parameters('virtualmachinename')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines", parameters('virtualmachinename'))]"], "properties": {"virtualmachineresourceid": "[resourceid('microsoft.compute/virtualmachines", parameters('virtualmachinename'))]", "sqlmanagement": "full", "sqlserverlicensetype": "payg", "storageconfigurationsettings": {"diskconfigurationtype": "[variables('diskconfigurationtype')]", "storageworkloadtype": "[parameters('storageworkloadtype')]", "sqldatasettings": {"luns": "[variables('datadisksluns')]", "defaultfilepath": "[parameters('datapath')]"}, "sqllogsettings": {"luns": "[variables('logdisksluns')]", "defaultfilepath": "[parameters('logpath')]"}, "sqltempdbsettings": {"defaultfilepath": "[variables('tempdbpath')]"}}}}
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\')]"}}}]}}}}
Storage Account with Storage Service Encryption and a blob deletion retention policy

{"type": "microsoft.storage/storageaccounts", "apiversion": "2021-02-01", "name": "[parameters('storageaccountname')]", "location": "[parameters('location')]", "sku": {"name": "[parameters('storageskuname')]", "tier": "[parameters('storageskutier')]"}, "kind": "[parameters('storagekind')]", "properties": {"accesstier": "[parameters('accesstier')]", "allowsharedkeyaccess": false, "supportshttpstrafficonly": true, "allowblobpublicaccess": false, "minimumtlsversion": "tls1_2"}}
Establish connection to a VNET via an ExpressRoute circuit

{"apiversion": "2016-03-30", "type": "microsoft.network/networksecuritygroups", "name": "[variables('vmnsgname')]", "location": "[parameters('location')]", "properties": {"securityrules": [{"name": "ssh", "properties": {"description": "allows ssh traffic", "protocol": "tcp", "sourceportrange": "22", "destinationportrange": "22", "sourceaddressprefix": "*", "destinationaddressprefix": "*", "access": "allow", "priority": 100, "direction": "inbound"}}]}}{"apiversion": "2016-03-30", "type": "microsoft.network/publicipaddresses", "name": "[variables('vmpipname')]", "location": "[parameters('location')]", "properties": {"publicipallocationmethod": "static"}}
Storage Account with Storage Service Encryption and a blob deletion retention policy

{"type": "microsoft.storage/storageaccounts", "name": "[parameters('newstorageaccountname')]", "apiversion": "2021-02-01", "location": "[parameters('location')]", "sku": {"name": "[variables('storageaccounttype')]"}}
This module creates a Shared Image Gallery resource with apiVersion 2019-12-01.

{"name": "[variables('chefbeavailname')]", "type": "microsoft.compute/availabilitysets", "location": "[resourcegroup().location]", "apiversion": "2017-12-01", "dependson": [], "tags": {"displayname": "beavailset", "provider": "[variables('tagvalues').provider]"}, "sku": {"name": "aligned"}, "properties": {"platformupdatedomaincount": 3, "platformfaultdomaincount": 3}}{"name": "[variables('cheffeavailname')]", "type": "microsoft.compute/availabilitysets", "location": "[resourcegroup().location]", "apiversion": "2017-12-01", "dependson": [], "tags": {"displayname": "feavailset", "provider": "[variables('tagvalues').provider]"}, "sku": {"name": "aligned"}, "properties": {"platformupdatedomaincount": 3, "platformfaultdomaincount": 3}}
Establish connection to a VNET via an ExpressRoute circuit

{"apiversion": "2015-06-15", "type": "microsoft.network/publicipaddresses", "name": "[concat(variables('publicipaddressname'), copyindex())]", "location": "[parameters('location')]", "copy": {"name": "publiciploop", "count": 1}, "tags": {"displayname": "publicipaddress"}, "properties": {"publicipallocationmethod": "[variables('publicipaddresstype')]", "dnssettings": {"domainnamelabel": "[concat(variables('dnsname'), copyindex())]"}}}{"apiversion": "2015-06-15", "type": "microsoft.network/virtualnetworks", "name": "[variables('virtualnetworkname')]", "location": "[parameters('location')]", "tags": {"displayname": "virtualnetwork"}, "properties": {"addressspace": {"addressprefixes": ["[variables('addressprefix')]"]}, "subnets": [{"name": "[variables('subnetname')]", "properties": {"addressprefix": "[variables('subnetprefix')]"}}]}}{"apiversion": "2015-06-15", "type": "microsoft.network/networkinterfaces", "name": "[concat(variables('nicname'), copyindex())]", "location": "[parameters('location')]", "copy": {"name": "nicloop", "count": 1}, "tags": {"displayname": "networkinterface"}, "dependson": ["publiciploop", "[resourceid('microsoft.network/virtualnetworks/", variables('virtualnetworkname'))]"], "properties": {"ipconfigurations": [{"name": "ipconfig1", "properties": {"privateipallocationmethod": "dynamic", "publicipaddress": {"id": "[resourceid('microsoft.network/publicipaddresses", concat(variables('publicipaddressname'), copyindex()))]"}, "subnet": {"id": "[variables('subnetref')]"}}}]}}{"name": "[variables('nicname')]", "type": "microsoft.network/networkinterfaces", "location": "[parameters('location')]", "apiversion": "2015-06-15", "dependson": ["[resourceid('microsoft.network/virtualnetworks/", variables('virtualnetworkname'))]", "[resourceid('microsoft.network/publicipaddresses/", variables('publicipaddressname'))]"], "tags": {"displayname": "rsnetworkinterface"}, "properties": {"ipconfigurations": [{"name": "ipconfig1", "properties": {"privateipallocationmethod": "dynamic", "subnet": {"id": "[variables('subnetref')]"}, "publicipaddress": {"id": "[resourceid('microsoft.network/publicipaddresses", variables('publicipaddressname'))]"}}}]}}{"name": "[variables('publicipaddressname')]", "type": "microsoft.network/publicipaddresses", "location": "[parameters('location')]", "apiversion": "2015-06-15", "tags": {"displayname": "publicrsipaddress"}, "properties": {"publicipallocationmethod": "[variables('publicipaddresstype')]", "dnssettings": {"domainnamelabel": "[variables('dnsname')]"}}}
Deploy SQL Always ON setup with existing SQL Virtual Machines.

{"type": "microsoft.sqlvirtualmachine/sqlvirtualmachines", "apiversion": "2017-03-01-preview", "name": "[trim(variables('existingvmlistarray')[copyindex()])]", "location": "[parameters('location')]", "copy": {"name": "sqlvirtualmachineloop", "count": "[length(variables('existingvmlistarray'))]"}, "properties": {"virtualmachineresourceid": "[resourceid(parameters('existingvmresourcegroup'), "microsoft.compute/virtualmachines", trim(variables('existingvmlistarray')[copyindex()]))]", "sqlserverlicensetype": "[parameters('sqlserverlicensetype')]"}}{"type": "microsoft.sqlvirtualmachine/sqlvirtualmachinegroups", "apiversion": "2017-03-01-preview", "name": "[parameters('failoverclustername')]", "location": "[parameters('location')]", "properties": {"sqlimageoffer": "[parameters('sqlserverimagetype')]", "sqlimagesku": "enterprise", "wsfcdomainprofile": {"domainfqdn": "[parameters('existingfullyqualifieddomainname')]", "oupath": "[parameters('existingoupath')]", "clusterbootstrapaccount": "[parameters('existingdomainaccount')]", "clusteroperatoraccount": "[parameters('existingdomainaccount')]", "sqlserviceaccount": "[parameters('existingsqlserviceaccount')]", "storageaccounturl": "[reference(resourceid('microsoft.storage/storageaccounts", parameters('cloudwitnessname')), "2018-07-01').primaryendpoints["blob"]]", "storageaccountprimarykey": "[listkeys(resourceid('microsoft.storage/storageaccounts", parameters('cloudwitnessname')), "2018-07-01').keys[0].value]"}}}
This module creates a Shared Image Gallery resource with apiVersion 2019-12-01.

{"type": "microsoft.compute/virtualmachines", "apiversion": "2020-12-01", "name": "[variables('vmname')[copyindex()]]", "location": "[parameters('location')]", "zones": ["[copyindex(1)]"], "dependson": ["nicloop"], "copy": {"name": "vmloop", "count": 2}, "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')[copyindex()]]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('imagepublisher')]", "offer": "[variables('imageoffer')]", "sku": "[variables('imagesku')]", "version": "latest"}, "osdisk": {"caching": "readonly", "createoption": "fromimage", "manageddisk": {"storageaccounttype": "standardssd_lrs"}}, "datadisks": [{"disksizegb": 64, "lun": 0, "createoption": "empty"}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('nicname')[copyindex()])]"}]}}}{"type": "microsoft.compute/virtualmachines/extensions", "apiversion": "2020-12-01", "name": "[concat(variables('vmname')[0], "/createadforest')]", "location": "[parameters('location')]", "dependson": ["vmloop"], "properties": {"publisher": "microsoft.powershell", "type": "dsc", "typehandlerversion": "2.24", "autoupgrademinorversion": true, "settings": {"configuration": {"url": "[uri(parameters('_artifactslocation'), "dsc/createadpdc.ps1.zip')]", "script": "createadpdc.ps1", "function": "createadpdc"}, "configurationarguments": {"domainname": "[parameters('domainname')]"}}, "protectedsettings": {"configurationurlsastoken": "[parameters('_artifactslocationsastoken')]", "configurationarguments": {"admincreds": {"username": "[parameters('adminusername')]", "password": "[parameters('adminpassword')]"}}}}}
This module creates a Shared Image Gallery resource with apiVersion 2019-12-01.

{"apiversion": "2017-03-30", "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')]", "linuxconfiguration": {"disablepasswordauthentication": true, "ssh": {"publickeys": [{"path": "[concat('/home/",parameters('adminusername'),"/.ssh/authorized_keys')]", "keydata": "[parameters('sshpublickey')]"}]}}}, "storageprofile": {"imagereference": {"publisher": "canonical", "offer": "ubuntuserver", "sku": "18.04-lts", "version": "latest"}, "osdisk": {"name": "[concat(variables('vmname'),"_osdisk')]", "caching": "readwrite", "createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[concat(reference(resourceid('microsoft.storage/storageaccounts", variables('storageaccountname')), "2020-08-01-preview').primaryendpoints.blob)]"}}}, "resources": [{"type": "extensions", "name": "[variables('vmextensionname')]", "apiversion": "2017-03-30", "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/", variables('_extensionscript'), parameters('_artifactslocationsastoken')))]"]}, "protectedsettings": {"commandtoexecute": "[concat('sh tigscript.sh", " ", variables('_configfilelocation'))]"}}}]}
This module creates a Shared Image Gallery resource with apiVersion 2019-12-01.

{"type": "microsoft.compute/availabilitysets", "name": "[concat(variables('availabilitysetname'), "-", copyindex())]", "apiversion": "2020-06-01", "location": "[parameters('location')]", "copy": {"name": "asloop", "count": 2}, "properties": {"platformfaultdomaincount": 2, "platformupdatedomaincount": 2}, "sku": {"name": "aligned"}}{"type": "microsoft.compute/virtualmachines", "name": "[concat('myvm", copyindex())]", "apiversion": "2020-06-01", "location": "[parameters('location')]", "copy": {"name": "virtualmachineloop", "count": "[parameters('numberofinstances')]"}, "dependson": ["[resourceid('microsoft.network/networkinterfaces", concat('nic", copyindex()))]", "asloop"], "properties": {"availabilityset": {"id": "[resourceid('microsoft.compute/availabilitysets", concat(variables('availabilitysetname'), "-", mod(copyindex(),2)))]"}, "hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[concat('vm", copyindex())]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": "[variables('imagereference')[parameters('os')]]", "osdisk": {"createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", concat('nic", copyindex()))]"}]}}}
This template creates an automation rule that triggers on incident creation (with certain conditions), executes a playbook and modifies two incident properies

{"type": "microsoft.securityinsights/automationrules", "name": "[variables('automationruleguid')]", "scope": "[concat('microsoft.operationalinsights/workspaces/", parameters('existingworkspacename'))]", "apiversion": "2019-01-01-preview", "properties": {"displayname": "[parameters('automationrulename')]", "order": 2, "triggeringlogic": {"isenabled": true, "expirationtimeutc": none, "triggerson": "incidents", "triggerswhen": "created", "conditions": [{"conditiontype": "property", "conditionproperties": {"propertyname": "incidentrelatedanalyticruleids", "operator": "contains", "propertyvalues": ["[resourceid('microsoft.operationalinsights/workspaces/providers/alertrules",parameters('existingworkspacename'),"microsoft.securityinsights",parameters('existingruleid'))]"]}}, {"conditiontype": "property", "conditionproperties": {"propertyname": "incidentseverity", "operator": "equals", "propertyvalues": ["high"]}}, {"conditiontype": "property", "conditionproperties": {"propertyname": "incidenttactics", "operator": "contains", "propertyvalues": ["initialaccess", "execution"]}}, {"conditiontype": "property", "conditionproperties": {"propertyname": "incidenttitle", "operator": "contains", "propertyvalues": ["urgent"]}}]}, "actions": [{"order": 2, "actiontype": "modifyproperties", "actionconfiguration": {"status": "closed", "classification": "undetermined", "classificationreason": none}}, {"order": 3, "actiontype": "modifyproperties", "actionconfiguration": {"labels": [{"labelname": "tag"}]}}]}}
This module creates a storageAccount resource with apiVersion 2021-01-01.

{"apiversion": "2021-04-01", "type": "microsoft.storage/storageaccounts", "name": "[variables('storageaccountname')]", "location": "[variables('location')]", "sku": {"name": "standard_ragrs"}, "kind": "storagev2", "properties": {"supportshttpstrafficonly": false, "accesstier": "hot", "encryption": {"services": {"blob": {"enabled": true}, "file": {"enabled": true}}, "keysource": "microsoft.storage"}}}
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'))]"]}
Provision an Azure Cognitive Search service

{"type": "microsoft.search/searchservices", "apiversion": "2020-08-01", "name": "[parameters('name')]", "location": "[parameters('location')]", "sku": {"name": "[parameters('sku')]"}, "properties": {"replicacount": "[parameters('replicacount')]", "partitioncount": "[parameters('partitioncount')]", "hostingmode": "[parameters('hostingmode')]"}}