Powershell Core Tutorial for Beginners

Resource deployment using ARM template from the Powershell

We have completed how to deploy a virtual machine from the PowerShell, here we will learn how to deploy resource using ARM template with the Powershell commands.

The ARM template is a JSON file contains all the detail required to deploy a resource. Here we will use an ARM template that contains details about deploying a Storge account.

Create a file named storage.json with “vi” editor and add the below content.

{                                                                                  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",                                                
  "contentVersion": "",
  "parameters": {
    "storageAccountType": {
      "type": "string",
      "defaultValue": "Standard_LRS",
      "allowedValues": [
      "metadata": {
        "description": "Types of storage accounts"
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "Location for all resources."
  "variables": {
    "storageAccountName": "techiesarmstorage"
  "resources": [
      "type": "Microsoft.Storage/storageAccounts",
      "name": "[variables('storageAccountName')]",
      "location": "[parameters('location')]",
      "apiVersion": "2019-04-01",
      "sku": {
        "name": "[parameters('storageAccountType')]"
      "kind": "StorageV2",
      "properties": {}
  "outputs": {
    "storageAccountName": {
      "type": "string",
      "value": "[variables('storageAccountName')]"

We have the ARM template ready,  in this template, I have added a name for our storage account which is “techiesarmstorage”, next execute below command to deploy it.

PS /home/techies> New-AzResourceGroupDeployment `
>> -Name armdeployment `
>> -ResourceGroupName Techies_DevOps `
>> -TemplateFile ./storage.json

The “New-AzResourceGroupDeployment” command is used for the ARM template deployment and the “-Name” argument is the name for the deployment. (This is not the name of storage account)

We can see the deployment status under the Resource Group -> Overview -> Deployments section.

Once the deployment is completed, a few details about the resource will be printed in the terminal.


Here the provisioning state is ‘success’, it means we have successfully deployed a resource using the ARM template from the Powershell.

Leave a Reply

Your email address will not be published. Required fields are marked *