Description
stringlengths
21
195
IaC
stringlengths
201
6.84k
Establish connection to a VNET via an ExpressRoute circuit
{"type": "microsoft.network/virtualnetworks", "apiversion": "2020-06-01", "name": "[variables('vnetname')]", "location": "[variables('location')]", "properties": {"addressspace": {"addressprefixes": ["172.16.0.0/16"]}, "enableddosprotection": false, "enablevmprotection": false, "subnets": [{"name": "[parameters('frontendsubnet')]", "properties": {"addressprefix": "172.16.0.0/24", "serviceendpoints": [{"service": "microsoft.sql"}], "privateendpointnetworkpolicies": "disabled", "privatelinkservicenetworkpolicies": "disabled"}}, {"name": "[parameters('backendsubnet')]", "properties": {"addressprefix": "172.16.1.0/24", "privateendpointnetworkpolicies": "disabled", "privatelinkservicenetworkpolicies": "disabled"}}, {"name": "[parameters('gatewaysubnet')]", "properties": {"addressprefix": "172.16.255.0/27", "privateendpointnetworkpolicies": "disabled", "privatelinkservicenetworkpolicies": "disabled"}}]}}{"type": "microsoft.network/virtualnetworks/subnets", "apiversion": "2020-06-01", "name": "[concat(variables('vnetname'), "/",parameters('frontendsubnet'))]", "dependson": ["[resourceid('microsoft.network/virtualnetworks", variables('vnetname'))]"], "properties": {"addressprefix": "172.16.0.0/24", "serviceendpoints": [{"service": "microsoft.sql"}], "privateendpointnetworkpolicies": "disabled", "privatelinkservicenetworkpolicies": "disabled"}}
Create a VM from a Windows Image with 4 Empty Data Disks
{"apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "identity": {"type": "systemassigned"}, "dependson": ["[variables('blobstorageaccountprivateendpointid')]", "[variables('nicid')]"], "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", "disksizegb": "[parameters('osdisksize')]", "manageddisk": {"storageaccounttype": "[parameters('diskstorageaccountype')]"}}, "copy": [{"name": "datadisks", "count": "[parameters('numdatadisks')]", "input": {"caching": "[parameters('datadiskcaching')]", "disksizegb": "[parameters('datadisksize')]", "lun": "[copyindex('datadisks')]", "name": "[concat(parameters('vmname'),"-datadisk",copyindex('datadisks'))]", "createoption": "empty", "manageddisk": {"storageaccounttype": "[parameters('diskstorageaccountype')]"}}}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('blobstorageaccountid')).primaryendpoints["blob"]]"}}}}{"apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'), "/customscript')]", "location": "[parameters('location')]", "dependson": ["[variables('vmid')]", "[variables('keyvaultid')]", "[variables('keyvaultprivateendpointid')]", "[variables('keyvaultprivatednszonegroupid')]"], "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": true, "settings": {"skipdos2unix": false, "timestamp": 123456789, "fileuris": ["[variables('scriptfileuri')]"]}, "protectedsettings": {"commandtoexecute": "[concat('bash ", parameters('scriptfilename'), " ", variables('keyvaultserviceendpoint'), " ", variables('blobserviceprimaryendpoint'), " ", variables('azureenvironment'))]"}}}{"condition": "[parameters('deployloganalytics')]", "apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'),"/loganalytics')]", "location": "[parameters('location')]", "dependson": ["[variables('vmid')]", "[variables('workspaceid')]", "[variables('customscriptid')]"], "properties": {"publisher": "microsoft.enterprisecloud.monitoring", "type": "omsagentforlinux", "typehandlerversion": "1.12", "settings": {"workspaceid": "[reference(variables('workspaceid'), "2020-03-01-preview').customerid]", "stoponmultipleconnections": false}, "protectedsettings": {"workspacekey": "[listkeys(variables('workspaceid'),"2020-03-01-preview').primarysharedkey]"}}}{"condition": "[parameters('deployloganalytics')]", "apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'),"/dependencyagent')]", "location": "[parameters('location')]", "dependson": ["[variables('vmid')]", "[variables('workspaceid')]", "[variables('customscriptid')]", "[variables('omsagentforlinuxid')]"], "properties": {"publisher": "microsoft.azure.monitoring.dependencyagent", "type": "dependencyagentlinux", "typehandlerversion": "9.10", "autoupgrademinorversion": true}}
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')]"}}}
Establish connection to a VNET via an ExpressRoute circuit
{"type": "microsoft.network/publicipaddresses", "apiversion": "2021-03-01", "name": "[variables('publicipaddressname')]", "sku": {"name": "basic"}, "location": "[parameters('location')]", "properties": {"publicipaddressversion": "ipv4", "publicipallocationmethod": "[variables('publicipaddresstype')]"}}
This module creates a Shared Image Gallery resource with apiVersion 2019-12-01.
{"type": "microsoft.compute/virtualmachines", "apiversion": "2019-07-01", "name": "vslab", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts", parameters('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": "visualstudio2019latest", "sku": "vs-2019-comm-latest-ws2019", "version": "latest"}, "osdisk": {"name": "labvmosdisk", "caching": "readwrite", "createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", "vslab-nic')]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(resourceid('microsoft.storage/storageaccounts/", parameters('storagename'))).primaryendpoints.blob]"}}}}{"type": "microsoft.compute/virtualmachines/extensions", "apiversion": "2019-07-01", "name": "vslab/installscript1", "location": "[parameters('location')]", "tags": {"displayname": "install script for labvm"}, "dependson": ["[resourceid('microsoft.compute/virtualmachines", "vslab')]"], "properties": {"publisher": "microsoft.compute", "type": "customscriptextension", "typehandlerversion": "1.10", "autoupgrademinorversion": true, "settings": {"fileuris": ["[variables('scripturl')]"]}, "protectedsettings": {"commandtoexecute": "[concat('powershell -executionpolicy bypass -file installscript.ps1 -username ",parameters('adminuser'))]"}}}
This module creates a Shared Image Gallery resource with apiVersion 2019-12-01.
{"type": "microsoft.compute/virtualmachines/extensions", "apiversion": "2020-06-01", "name": "[concat('vm-r1","-",copyindex(1),"/","installwebserver')]", "location": "[parameters('location-r1')]", "copy": {"name": "extensioncopy", "count": 3}, "dependson": ["vmcopy"], "properties": {"publisher": "microsoft.compute", "type": "customscriptextension", "typehandlerversion": "1.7", "autoupgrademinorversion": true, "settings": {"commandtoexecute": "powershell.exe install-windowsfeature -name web-server -includemanagementtools && powershell.exe remove-item "c:\\inetpub\\wwwroot\\iisstart.htm" && powershell.exe add-content -path "c:\\inetpub\\wwwroot\\iisstart.htm" -value $('hello world from " + $env:computername)"}}}{"type": "microsoft.compute/virtualmachines", "apiversion": "2020-06-01", "name": "[concat('vm-r1","-",copyindex(1))]", "location": "[parameters('location-r1')]", "zones": ["[copyindex(1)]"], "copy": {"name": "vmcopy", "count": 3}, "dependson": ["networkinterfacecopy"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "storageprofile": {"imagereference": {"publisher": "microsoftwindowsserver", "offer": "windowsserver", "sku": "2019-datacenter", "version": "latest"}, "osdisk": {"createoption": "fromimage", "manageddisk": {"storageaccounttype": "[variables('vmstorageaccounttype')]"}}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", concat('vm-r1","-", copyindex(1), "-networkinterface'))]"}]}, "osprofile": {"computername": "[concat('vm-r1","-",copyindex(1))]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]", "windowsconfiguration": {"enableautomaticupdates": true, "provisionvmagent": true}}}}
Establish connection to a VNET via an ExpressRoute circuit
{"apiversion": "2015-06-15", "type": "microsoft.network/publicipaddresses", "name": "[variables('publicipaddressname')]", "location": "[parameters('location')]", "tags": {"displayname": "publicipaddress"}, "properties": {"publicipallocationmethod": "[variables('publicipaddresstype')]", "dnssettings": {"domainnamelabel": "[parameters('dnsnameforpublicip')]"}}}{"apiversion": "2017-03-01", "type": "microsoft.network/networkinterfaces", "name": "[variables('nicname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/publicipaddresses/", variables('publicipaddressname'))]"], "tags": {"displayname": "networkinterface"}, "properties": {"networksecuritygroup": {"id": "[resourceid(parameters('existingvirtualnetworkresourcegroup'), "microsoft.network/networksecuritygroups", parameters('existingsecuritygroupname'))]"}, "ipconfigurations": [{"name": "ipconfig1", "properties": {"privateipallocationmethod": "dynamic", "publicipaddress": {"id": "[resourceid('microsoft.network/publicipaddresses",variables('publicipaddressname'))]"}, "subnet": {"id": "[variables('subnetref')]"}}}]}}
Create a VM from a Windows Image with 4 Empty Data Disks
{"apiversion": "2019-12-01", "type": "microsoft.compute/availabilitysets", "name": "[variables('availabilitysetname')]", "location": "[parameters('location')]", "sku": {"name": "aligned"}, "properties": {"platformfaultdomaincount": "[variables('platformfaultdomaincount')]", "platformupdatedomaincount": "[variables('platformupdatedomaincount')]"}}
This module creates a Shared Image Gallery resource with apiVersion 2019-12-01.
{"type": "microsoft.compute/availabilitysets", "apiversion": "2019-03-01", "location": "[parameters('location')]", "name": "[parameters('availabilitysetname')]", "properties": {"platformupdatedomaincount": 20, "platformfaultdomaincount": 2}, "sku": {"name": "aligned"}}
Establish connection to a VNET via an ExpressRoute circuit
{"type": "microsoft.network/publicipaddresses", "apiversion": "2021-02-01", "name": "[parameters('publicipaddressname')]", "location": "[parameters('location')]", "properties": {"publicipallocationmethod": "dynamic", "dnssettings": {"domainnamelabel": "[parameters('dnslabelprefix')]"}}}{"type": "microsoft.network/networkinterfaces", "apiversion": "2021-02-01", "name": "[variables('nicname')]", "location": "[parameters('location')]", "properties": {"ipconfigurations": [{"name": "ipconfig1", "properties": {"privateipallocationmethod": "dynamic", "publicipaddress": {"id": "[resourceid('microsoft.network/publicipaddresses", parameters('publicipaddressname'))]"}, "subnet": {"id": "[resourceid('microsoft.network/virtualnetworks/subnets", parameters('existingvnetname'), parameters('existingsubnetname'))]"}}}]}, "dependson": ["[resourceid('microsoft.network/publicipaddresses", parameters('publicipaddressname'))]"]}
Create a VM from a Windows Image with 4 Empty Data Disks
{"apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines", "name": "[variables('jumpboxvmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts", variables('storageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces", variables('jumpboxnicname'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmmastersku')]"}, "osprofile": {"computername": "[variables('jumpboxvmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpasswordorkey')]", "linuxconfiguration": "[if(equals(parameters('authenticationtype'), "password'), json('null'), variables('linuxconfiguration'))]"}, "storageprofile": {"imagereference": "[parameters('vmimagereference')]", "osdisk": {"createoption": "fromimage"}, "datadisks": [{"lun": 0, "name": "jumpboxdatadisk", "disksizegb": "[parameters('vmmasterdisksize')]", "caching": "none", "createoption": "empty", "manageddisk": {"storageaccounttype": "[parameters('vmmasterdisktype')]"}}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('jumpboxnicname'))]"}]}}}{"type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(variables('jumpboxvmname'),"/nfinit')]", "apiversion": "2019-12-01", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines", variables('jumpboxvmname'))]"], "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": true, "forceupdatetag": "[parameters('forceupdatetag')]", "settings": {"fileuris": ["[variables('nextflowinitscript')]", "[parameters('_diskinitscripturi')]"]}, "protectedsettings": {"commandtoexecute": "[format(\"bash init.sh {0} "{1}" {2} {3} {4} {5} {6} {7} {8} {9} {10}\", variables(\"storageaccountname\'), listkeys(resourceid(\"microsoft.storage/storageaccounts\", variables(\"storageaccountname\')), \"2019-06-01\').keys[0].value, parameters(\"sharename\'), variables(\"storagesuffix\'), parameters(\"mountpointpath\'), \"false\", parameters(\"adminusername\'), \"0\", parameters(\"nextflowinstallurl\'), parameters(\"vmadditionalinstallscripturl\'), parameters(\"vmadditionalinstallscriptargument\'))]"}}}{"type": "microsoft.compute/virtualmachinescalesets", "name": "[variables('vmssname')]", "location": "[parameters('location')]", "apiversion": "2019-12-01", "sku": {"name": "[parameters('vmnodesku')]", "capacity": "[parameters('instancecount')]"}, "dependson": ["[resourceid('microsoft.network/virtualnetworks", parameters('vnetname'))]", "[resourceid('microsoft.storage/storageaccounts", variables('storageaccountname'))]"], "properties": {"overprovision": true, "upgradepolicy": {"mode": "manual"}, "virtualmachineprofile": {"storageprofile": {"osdisk": {"createoption": "fromimage", "caching": "readwrite"}, "imagereference": "[parameters('vmimagereference')]"}, "osprofile": {"computernameprefix": "[variables('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('microsoft.network/virtualnetworks/subnets", parameters('vnetname'), parameters('subnetname'))]"}}}]}}]}, "extensionprofile": {"extensions": [{"name": "filesextension", "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": true, "forceupdatetag": "[parameters('forceupdatetag')]", "settings": {"fileuris": ["[variables('nextflowinitscript')]", "[parameters('_diskinitscripturi')]"]}, "protectedsettings": {"commandtoexecute": "[format(\"bash init.sh {0} "{1}" {2} {3} {4} {5} {6} {7} {8} {9} {10}\", variables(\"storageaccountname\'), listkeys(resourceid(\"microsoft.storage/storageaccounts\", variables(\"storageaccountname\')), \"2019-06-01\').keys[0].value, parameters(\"sharename\'), variables(\"storagesuffix\'), parameters(\"mountpointpath\'), \"true\", parameters(\"adminusername\'), parameters(\"nodemaxcpus\'), parameters(\"nextflowinstallurl\'), parameters(\"vmadditionalinstallscripturl\'), parameters(\"vmadditionalinstallscriptargument\'))]"}}}]}}}}
This template creates a data collection rule defining the data source (Syslog) and the destination workspace.
{"type": "microsoft.insights/autoscalesettings", "name": "[variables('settingname')]", "dependson": ["[resourceid('microsoft.compute/virtualmachinescalesets", variables('naminginfix'))]"], "apiversion": "2015-04-01", "location": "[parameters('location')]", "properties": {"profiles": [{"name": "defaultautoscaleprofile", "capacity": {"minimum": "[parameters('minimumcapacity')]", "maximum": "[parameters('maximumcapacity')]", "default": "[parameters('defaultcapacity')]"}, "rules": [{"metrictrigger": {"metricname": "[parameters('metricname')]", "metricresourceuri": "[resourceid('microsoft.compute/virtualmachinescalesets", variables('naminginfix'))]", "timegrain": "pt5m", "statistic": "average", "timewindow": "pt10m", "timeaggregation": "average", "operator": "greaterthan", "threshold": "[parameters('metricthresholdtoscaleout')]"}, "scaleaction": {"direction": "increase", "type": "percentchangecount", "value": "[parameters('changepercentscaleout')]", "cooldown": "pt10m"}}, {"metrictrigger": {"metricname": "[parameters('metricname')]", "metricresourceuri": "[resourceid('microsoft.compute/virtualmachinescalesets", variables('naminginfix'))]", "timegrain": "pt5m", "statistic": "average", "timewindow": "pt10m", "timeaggregation": "average", "operator": "lessthan", "threshold": "[parameters('metricthresholdtoscalein')]"}, "scaleaction": {"direction": "decrease", "type": "percentchangecount", "value": "[parameters('changepercentscalein')]", "cooldown": "pt10m"}}]}], "enabled": "[parameters('autoscaleenabled')]", "targetresourceuri": "[resourceid('microsoft.compute/virtualmachinescalesets", variables('naminginfix'))]"}}
This template allows you to deploy an AKS cluster can be easily integrated with entreprise-grade devops process and fullfil the condition to be attached with Azure ML as compute target resources
{"type": "microsoft.containerinstance/containergroups", "apiversion": "2021-03-01", "name": "[variables('containergroupname')]", "location": "[parameters('location')]", "properties": {"containers": [{"name": "[variables('containername')]", "properties": {"image": "[variables('containerimageuri')]", "ports": [{"port": 80}], "resources": {"requests": {"cpu": 1, "memoryingb": 4}}}}], "restartpolicy": "onfailure", "ostype": "linux", "networkprofile": {"id": "[resourceid('microsoft.network/networkprofiles", variables('containergroupnetworkprofilename'))]"}}, "dependson": ["[resourceid('microsoft.network/networkprofiles", variables('containergroupnetworkprofilename'))]"]}
Establish connection to a VNET via an ExpressRoute circuit
{"comments": "simple network security group for subnet [variables('subnetname')]", "type": "microsoft.network/networksecuritygroups", "apiversion": "2020-05-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": "*"}}]}}{"type": "microsoft.network/virtualnetworks", "name": "[variables('virtualnetworkname')]", "location": "[parameters('location')]", "apiversion": "2020-05-01", "dependson": ["[resourceid('microsoft.network/networksecuritygroups", variables('networksecuritygroupname'))]"], "properties": {"addressspace": {"addressprefixes": ["[variables('addressprefix')]"]}, "subnets": [{"name": "[variables('subnetname')]", "properties": {"addressprefix": "[variables('subnetprefix')]", "networksecuritygroup": {"id": "[resourceid('microsoft.network/networksecuritygroups", variables('networksecuritygroupname'))]"}}}]}}{"type": "microsoft.network/networkinterfaces", "name": "[variables('jumpboxnicname')]", "location": "[parameters('location')]", "apiversion": "2020-05-01", "dependson": ["[resourceid('microsoft.network/publicipaddresses/", variables('publicipaddressname'))]", "[resourceid('microsoft.network/virtualnetworks/", variables('virtualnetworkname'))]"], "properties": {"ipconfigurations": [{"name": "[variables('jumpboxipconfigname')]", "properties": {"privateipallocationmethod": "dynamic", "publicipaddress": {"id": "[resourceid('microsoft.network/publicipaddresses",variables('publicipaddressname'))]"}, "subnet": {"id": "[variables('subnetref')]"}}}]}}
This module creates a key resource in an existing KeyVault with apiVersion 2019-09-01.
{"type": "microsoft.keyvault/vaults", "apiversion": "2021-06-01-preview", "name": "[parameters('keyvaultname')]", "location": "[parameters('location')]", "properties": {"sku": {"name": "standard", "family": "a"}, "tenantid": "[reference(resourceid('microsoft.managedidentity/userassignedidentities", variables('identityname'))).tenantid]", "enablerbacauthorization": true, "enablesoftdelete": true}, "dependson": ["[resourceid('microsoft.managedidentity/userassignedidentities", variables('identityname'))]"]}{"type": "microsoft.keyvault/vaults/secrets", "apiversion": "2019-09-01", "name": "[format('{0}/sslcert", parameters('keyvaultname'))]", "properties": {"value": "[parameters('sslcertvalue')]", "contenttype": "application/x-pkcs12", "attributes": {"enabled": true}}, "dependson": ["[resourceid('microsoft.keyvault/vaults", parameters('keyvaultname'))]"]}
Create a VM from a Windows Image with 4 Empty Data Disks
{"apiversion": "2017-03-30", "type": "microsoft.compute/virtualmachines", "name": "[variables('vmname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networkinterfaces/", concat(variables('vmname'), "-nic'))]"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "osprofile": {"computername": "[variables('vmname')]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('osimagepublisher')]", "offer": "[variables('osimageoffer')]", "sku": "[variables('osimagesku')]", "version": "latest"}, "osdisk": {"name": "[concat(variables('vmname'),"-osdisk')]", "caching": "readwrite", "createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",concat(variables('vmname'), "-nic'))]"}]}}}{"apiversion": "2015-06-15", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(variables('vmname'), "/installscript')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/virtualmachines/", variables('vmname'))]"], "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": true, "settings": {"fileuris": ["[variables('scriptdownloaduri')]"], "commandtoexecute": "[variables('installcommand')]"}}}
Storage Account with Storage Service Encryption and a blob deletion retention policy
{"apiversion": "2021-01-01", "type": "microsoft.storage/storageaccounts", "name": "[parameters('adlsstorageaccountname')]", "location": "[parameters('location')]", "sku": {"name": "standard_ragrs"}, "kind": "storagev2", "properties": {"networkacls": {"defaultaction": "[parameters('adlsstorageaccountnetworkaclsdefaultaction')]", "bypass": "azureservices"}, "allowblobpublicaccess": "[parameters('adlsstorageaccountallowblobpublicaccess')]"}}{"apiversion": "2021-01-01", "type": "microsoft.storage/storageaccounts", "name": "[parameters('blobstorageaccountname')]", "location": "[parameters('location')]", "sku": {"name": "standard_lrs"}, "kind": "storagev2", "properties": {"networkacls": {"defaultaction": "[parameters('blobstorageaccountnetworkaclsdefaultaction')]", "bypass": "azureservices"}, "allowblobpublicaccess": "[parameters('blobstorageaccountallowblobpublicaccess')]"}}
Create a VM from a Windows Image with 4 Empty Data Disks
{"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines", "name": "[concat(variables('region-tm-test-vm'),copyindex())]", "location": "[variables('region')[copyindex()]]", "tags": {"displayname": "regions-test-vms"}, "comments": "test vms to test traffic manager scenario from each region!", "dependson": ["region-tm-vm-pips-loop", "region-tm-vm-nics-loop"], "properties": {"hardwareprofile": {"vmsize": "[parameters('vmsize')]"}, "storageprofile": {"imagereference": {"publisher": "microsoftwindowsserver", "offer": "windowsserver", "sku": "2012-r2-datacenter", "version": "latest"}, "osdisk": {"createoption": "fromimage", "caching": "readwrite"}}, "osprofile": {"computername": "[replace(replace(concat(variables('region-tm-test-vm'),copyindex()),"_","'),"-","')]", "adminusername": "[parameters('adminuser')]", "windowsconfiguration": {"provisionvmagent": true, "enableautomaticupdates": true}, "adminpassword": "[parameters('adminuserpassword')]"}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces", concat(variables('region-tm-vm-nic'), copyindex()))]"}]}}, "copy": {"name": "test-vms-loop", "count": 2}}
This module creates a Shared Image Gallery resource with apiVersion 2019-12-01.
{"apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines", "name": "[parameters('vmname')]", "location": "[parameters('location')]", "dependson": ["[variables('eventhubsnamespaceprivateendpointid')]", "[variables('blobstorageaccountprivateendpointid')]", "[variables('nicid')]"], "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", "disksizegb": "[parameters('osdisksize')]", "manageddisk": {"storageaccounttype": "[parameters('diskstorageaccountype')]"}}, "copy": [{"name": "datadisks", "count": "[parameters('numdatadisks')]", "input": {"caching": "[parameters('datadiskcaching')]", "disksizegb": "[parameters('datadisksize')]", "lun": "[copyindex('datadisks')]", "name": "[concat(parameters('vmname'),"-datadisk",copyindex('datadisks'))]", "createoption": "empty", "manageddisk": {"storageaccounttype": "[parameters('diskstorageaccountype')]"}}}]}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",variables('nicname'))]"}]}, "diagnosticsprofile": {"bootdiagnostics": {"enabled": true, "storageuri": "[reference(variables('blobstorageaccountid')).primaryendpoints["blob"]]"}}}}{"apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'), "/", variables('customscriptextensionname'))]", "location": "[parameters('location')]", "dependson": ["[variables('vmid')]"], "properties": {"publisher": "microsoft.azure.extensions", "type": "customscript", "typehandlerversion": "2.0", "autoupgrademinorversion": true, "settings": {"skipdos2unix": false, "timestamp": 123456789, "fileuris": ["[variables('scriptfileuri')]"]}, "protectedsettings": {"commandtoexecute": "[concat('bash ", parameters('scriptfilename'), " ", variables('eventhubsnamespaceendpoint'), " ", variables('blobserviceprimaryendpoint'))]"}}}{"apiversion": "2019-12-01", "type": "microsoft.compute/virtualmachines/extensions", "name": "[concat(parameters('vmname'),"/", variables('omsagentforlinuxname'))]", "location": "[parameters('location')]", "dependson": ["[variables('vmid')]", "[variables('workspaceid')]", "[variables('customscriptid')]"], "properties": {"publisher": "microsoft.enterprisecloud.monitoring", "type": "omsagentforlinux", "typehandlerversion": "1.12", "settings": {"workspaceid": "[reference(variables('workspaceid'), "2020-03-01-preview').customerid]", "stoponmultipleconnections": false}, "protectedsettings": {"workspacekey": "[listkeys(variables('workspaceid'),"2020-03-01-preview').primarysharedkey]"}}}
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 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 template deploys 3 Nodetype Service Fabric Cluster. it also allows you to allows you to control the inbound and outbound network traffic using Network Security Groups
{"apiversion": "2018-02-01", "type": "microsoft.servicefabric/clusters", "name": "[parameters('clustername')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts/", variables('supportlogstorageaccountname'))]"], "properties": {"certificate": {"thumbprint": "[parameters('certificatethumbprint')]", "x509storename": "[parameters('certificatestorevalue')]"}, "clusterstate": "default", "diagnosticsstorageaccountconfig": {"blobendpoint": "[reference(resourceid('microsoft.storage/storageaccounts/", variables('supportlogstorageaccountname')), "2021-04-01').primaryendpoints.blob]", "protectedaccountkeyname": "storageaccountkey1", "queueendpoint": "[reference(resourceid('microsoft.storage/storageaccounts/", variables('supportlogstorageaccountname')), "2021-04-01').primaryendpoints.queue]", "storageaccountname": "[variables('supportlogstorageaccountname')]", "tableendpoint": "[reference(resourceid('microsoft.storage/storageaccounts/", variables('supportlogstorageaccountname')), "2021-04-01').primaryendpoints.table]"}, "fabricsettings": [{"parameters": [{"name": "clusterprotectionlevel", "value": "[parameters('clusterprotectionlevel')]"}], "name": "security"}], "managementendpoint": "[concat('https://", reference(variables('lbipnameurl')).dnssettings.fqdn,":",variables('nodesettings')[0].fabrichttpgatewayport)]", "copy": [{"name": "nodetypes", "count": "[length(variables('nodesettings'))]", "input": {"name": "[variables('nodesettings')[copyindex('nodetypes')].vmnodetypename]", "applicationports": {"endport": "[variables('nodesettings')[copyindex('nodetypes')].applicationendport]", "startport": "[variables('nodesettings')[copyindex('nodetypes')].applicationstartport]"}, "clientconnectionendpointport": "[variables('nodesettings')[copyindex('nodetypes')].fabrictcpgatewayport]", "durabilitylevel": "bronze", "ephemeralports": {"endport": "[variables('nodesettings')[copyindex('nodetypes')].ephemeralendport]", "startport": "[variables('nodesettings')[copyindex('nodetypes')].ephemeralstartport]"}, "httpgatewayendpointport": "[variables('nodesettings')[copyindex('nodetypes')].fabrichttpgatewayport]", "isprimary": true, "vminstancecount": "[variables('nodesettings')[0].instancecount]"}}], "provisioningstate": "default", "reliabilitylevel": "silver", "upgrademode": "automatic", "vmimage": "windows"}, "tags": {"resourcetype": "service fabric", "clustername": "[parameters('clustername')]"}}
Application Gateway routing Internet traffic to a virtual network (internal mode) API Management instance which services a web API hosted in an Azure Web App.
{"apiversion": "2019-08-01", "name": "[variables('hostingplanname')]", "type": "microsoft.web/serverfarms", "location": "[parameters('location')]", "tags": {"displayname": "hostingplan"}, "sku": {"name": "s1", "capacity": "1"}, "properties": {"name": "[variables('hostingplanname')]"}}
Establish connection to a VNET via an ExpressRoute circuit
{"type": "microsoft.network/networksecuritygroups", "apiversion": "2019-12-01", "name": "[parameters('backendnetworksecuritygroupname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/proximityplacementgroups", parameters('proximityplacementgroupname'))]"], "properties": {}}{"type": "microsoft.network/networksecuritygroups", "apiversion": "2019-12-01", "name": "[parameters('midtiernetworksecuritygroupname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/proximityplacementgroups", parameters('proximityplacementgroupname'))]"], "properties": {}}{"type": "microsoft.network/networksecuritygroups", "apiversion": "2019-12-01", "name": "[parameters('frontendnetworksecuritygroupname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.compute/proximityplacementgroups", parameters('proximityplacementgroupname'))]"], "properties": {"securityrules": [{"name": "allow_http_from_ip_or_range_forwebhttp", "type": "microsoft.network/networksecuritygroups/securityrules", "properties": {"protocol": "*", "sourceportrange": "*", "destinationportrange": "80", "sourceaddressprefix": "[parameters('allowfrontendconnectionfromiporcidrblock')]", "destinationaddressprefix": "*", "access": "allow", "priority": 500, "direction": "inbound"}}, {"name": "allow_ssh_from_ip_or_range_for_jumpboxssh", "type": "microsoft.network/networksecuritygroups/securityrules", "properties": {"protocol": "*", "sourceportrange": "*", "destinationportrange": "22", "sourceaddressprefix": "[parameters('allowfrontendconnectionfromiporcidrblock')]", "destinationaddressprefix": "*", "access": "allow", "priority": 510, "direction": "inbound"}}, {"name": "allow_https_from_ip_or_range_for_bastion", "type": "microsoft.network/networksecuritygroups/securityrules", "properties": {"protocol": "*", "sourceportrange": "*", "destinationportrange": "443", "sourceaddressprefix": "[parameters('allowfrontendconnectionfromiporcidrblock')]", "destinationaddressprefix": "*", "access": "allow", "priority": 520, "direction": "inbound"}}, {"name": "allow_ssh_to_vnet_for_bastion", "type": "microsoft.network/networksecuritygroups/securityrules", "properties": {"protocol": "*", "sourceportrange": "*", "destinationportrange": "22", "sourceaddressprefix": "*", "destinationaddressprefix": "virtualnetwork", "access": "allow", "priority": 530, "direction": "outbound"}}, {"name": "allow_rdp_to_vnet_for_bastion", "type": "microsoft.network/networksecuritygroups/securityrules", "properties": {"protocol": "*", "sourceportrange": "*", "destinationportrange": "3389", "sourceaddressprefix": "*", "destinationaddressprefix": "virtualnetwork", "access": "allow", "priority": 540, "direction": "outbound"}}, {"name": "allow_https_to_azurecloud_for_bastion", "type": "microsoft.network/networksecuritygroups/securityrules", "properties": {"protocol": "*", "sourceportrange": "*", "destinationportrange": "443", "sourceaddressprefix": "*", "destinationaddressprefix": "azurecloud", "access": "allow", "priority": 550, "direction": "outbound"}}, {"name": "allow_management_from_gateway_manager_for_appgateway", "type": "microsoft.network/networksecuritygroups/securityrules", "properties": {"protocol": "*", "sourceportrange": "*", "destinationportrange": "65200-65535", "sourceaddressprefix": "gatewaymanager", "destinationaddressprefix": "*", "access": "allow", "priority": 560, "direction": "inbound"}}, {"name": "allow_https_from_gateway_manager_for_appgateway", "type": "microsoft.network/networksecuritygroups/securityrules", "properties": {"protocol": "*", "sourceportrange": "*", "destinationportrange": "443", "sourceaddressprefix": "gatewaymanager", "destinationaddressprefix": "*", "access": "allow", "priority": 570, "direction": "inbound"}}]}}{"type": "microsoft.network/virtualnetworks", "apiversion": "2019-12-01", "name": "[parameters('virtualnetworkname')]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/networksecuritygroups", parameters('backendnetworksecuritygroupname'))]", "[resourceid('microsoft.network/networksecuritygroups", parameters('midtiernetworksecuritygroupname'))]", "[resourceid('microsoft.compute/proximityplacementgroups", parameters('proximityplacementgroupname'))]"], "properties": {"addressspace": {"addressprefixes": ["10.2.0.0/16"]}, "subnets": [{"name": "gatewaysubnet", "properties": {"addressprefix": "10.2.0.224/27"}}, {"name": "azurebastionsubnet", "properties": {"addressprefix": "10.2.0.192/27", "networksecuritygroup": {"id": "[resourceid('microsoft.network/networksecuritygroups", parameters('frontendnetworksecuritygroupname'))]"}}}, {"name": "frontendsubnet", "properties": {"addressprefix": "10.2.0.160/27", "networksecuritygroup": {"id": "[resourceid('microsoft.network/networksecuritygroups", parameters('frontendnetworksecuritygroupname'))]"}}}, {"name": "appgatewaysubnet", "properties": {"addressprefix": "10.2.0.128/27", "networksecuritygroup": {"id": "[resourceid('microsoft.network/networksecuritygroups", parameters('frontendnetworksecuritygroupname'))]"}}}, {"name": "backendsubnet", "properties": {"addressprefix": "10.2.1.0/24", "networksecuritygroup": {"id": "[resourceid('microsoft.network/networksecuritygroups", parameters('backendnetworksecuritygroupname'))]"}}}, {"name": "midtiersubnet", "properties": {"addressprefix": "10.2.0.0/28", "networksecuritygroup": {"id": "[resourceid('microsoft.network/networksecuritygroups", parameters('midtiernetworksecuritygroupname'))]"}}}]}}
This module creates a storageAccount resource with apiVersion 2021-01-01.
{"apiversion": "2021-02-01", "type": "microsoft.storage/storageaccounts", "name": "[variables('supportlogstorageaccountname')]", "location": "[variables('computelocation')]", "properties": {}, "kind": "storage", "sku": {"name": "[parameters('supportlogstorageaccounttype')]"}, "tags": {"resourcetype": "service fabric", "clustername": "[parameters('clustername')]"}}{"apiversion": "2021-02-01", "type": "microsoft.storage/storageaccounts", "name": "[variables('applicationdiagnosticsstorageaccountname')]", "location": "[variables('computelocation')]", "properties": {}, "kind": "storage", "sku": {"name": "[parameters('applicationdiagnosticsstorageaccounttype')]"}, "tags": {"resourcetype": "service fabric", "clustername": "[parameters('clustername')]"}}
Create a VM from a Windows Image with 4 Empty Data Disks
{"apiversion": "2020-12-01", "type": "microsoft.compute/availabilitysets", "name": "[variables('availabilitysetname')]", "location": "[parameters('location')]", "sku": {"name": "aligned"}, "properties": {"platformfaultdomaincount": 2, "platformupdatedomaincount": 5}}{"apiversion": "2020-12-01", "type": "microsoft.compute/virtualmachines", "name": "[concat(variables('appvmname'),copyindex())]", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.storage/storageaccounts/", variables('storageaccountname'))]", "[resourceid('microsoft.network/networkinterfaces/", concat(variables('appvmname'), copyindex(), "-nic'))]", "[resourceid('microsoft.compute/availabilitysets/", variables('availabilitysetname'))]"], "properties": {"availabilityset": {"id": "[resourceid('microsoft.compute/availabilitysets",variables('availabilitysetname'))]"}, "hardwareprofile": {"vmsize": "[parameters('appvmsize')]"}, "osprofile": {"computername": "[concat(variables('appvmname'),copyindex())]", "adminusername": "[parameters('adminusername')]", "adminpassword": "[parameters('adminpassword')]"}, "storageprofile": {"imagereference": {"publisher": "[variables('osimagepublisher')]", "offer": "[variables('osimageoffer')]", "sku": "[variables('osimagesku')]", "version": "latest"}, "osdisk": {"name": "[concat(variables('appvmname'),copyindex(),"_osdisk')]", "caching": "readwrite", "createoption": "fromimage"}}, "networkprofile": {"networkinterfaces": [{"id": "[resourceid('microsoft.network/networkinterfaces",concat(variables('appvmname'), copyindex(), "-nic'))]"}]}}, "copy": {"name": "appvmcopy", "count": "[parameters('appvmcount')]"}}