Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this Quickstart, you use Visual Studio Code to create Azure Resource Manager templates (ARM templates). For a tutorial that is more focused on syntax, see Tutorial: Create and deploy your first ARM template.
Important
Azure Resource Manager (ARM) Tools extension for Visual Studio Code is deprecated and will no longer be supported after October 1, 2025. For Bicep development, we recommend using the Bicep extension for Visual Studio Code. To learn more, see Quickstart: Create Bicep files with Visual Studio Code. Note that "transient install" methods like GitHub Codespaces will continue to function even after deprecation. To manually install the extension, you can get it here."
If you don't have an Azure subscription, create a trial subscription before you begin.
To complete this quickstart, you need Visual Studio Code. You also need either the Azure CLI or the Azure PowerShell module installed and authenticated.
Create an ARM template
Create and open with Visual Studio Code a new file named azuredeploy.json.
Add the following JSON snippet to the file for scaffolding out an ARM template:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"functions": [],
"variables": {},
"resources": [],
"outputs": {}
}
The template has the following sections: parameters
, functions
, variables
, resources
, and outputs
. Each section is currently empty.
Add an Azure resource
Update the resources section with the following snippet to include a storage account.
"resources": [{
"name": "storageaccount1",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2025-01-01",
"tags": {
"displayName": "storageaccount1"
},
"location": "[resourceGroup().location]",
"kind": "StorageV2",
"sku": {
"name": "Premium_LRS",
"tier": "Premium"
}
}],
Use [ALT] + [SHIFT] + [F] to format the document for better readability.
Add template parameters
Update the parameters section to include a parameter for the storage account name.
"parameters": {
"storageAccountName": {
"type": "string",
"metadata": {
"description": "Storage account name"
},
"defaultValue": "[format('storage{0}', uniqueString(resourceGroup().id))]"
}
},
Azure storage account names have a minimum length of three characters and a maximum of 24. Add both minLength
and maxLength
to the parameter and provide appropriate values.
"parameters": {
"storageAccountName": {
"type": "string",
"metadata": {
"description": "Storage account name"
},
"defaultValue": "[format('storage{0}', uniqueString(resourceGroup().id))]",
"minLength": 3,
"maxLength": 24
}
},
Now, on the storage resource, update the name property to use the parameter.
"resources": [
{
"name": "[parameters('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
...
Upon completion, your template looks like:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName": {
"type": "string",
"metadata": {
"description": "Storage account name"
},
"defaultValue": "[format('storage{0}', uniqueString(resourceGroup().id))]",
"minLength": 3,
"maxLength": 24
}
},
"functions": [],
"variables": {},
"resources": [
{
"name": "[parameters('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2025-01-01",
"tags": {
"displayName": "storageaccount1"
},
"location": "[resourceGroup().location]",
"kind": "StorageV2",
"sku": {
"name": "Premium_LRS",
"tier": "Premium"
}
}
],
"outputs": {}
}
Deploy the template
Open the integrated Visual Studio Code terminal using the ctrl
+ `
key combination and use either the Azure CLI or Azure PowerShell module to deploy the template.
az group create --name arm-vscode --location chinaeast
az deployment group create --resource-group arm-vscode --template-file azuredeploy.json
Clean up resources
When you no longer need the Azure resources, use the Azure CLI or Azure PowerShell module to delete the quickstart resource group.
az group delete --name arm-vscode