Deploying an ARM Template in Complete Mode with PowerShell

1.75 hours
  • 3 Learning Objectives

About this Hands-on Lab

For a more declarative approach to your resource deployments, Azure offers two types of deployment modes: incremental and complete. In complete mode, only the resources in the ARM template will be deployed to the resource group, and everything else will be deleted. In PowerShell, you can specify a mode when deploying resources, and in this hands-on lab, that is your objective.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Connect to Cloud Shell in the Azure Portal
  1. Open a web browser and go to https://portal.azure.com.
  2. Use the username and password provided with this hands-on lab to log in to the portal.
  3. Click the Cloud Shell icon in top menu bar to open it.
  4. Select PowerShell.
  5. Click Show advanced settings.
  6. Create a new storage account that is globally unique.
  7. Create a file share named "fileshare".
  8. Click Create storage.
Create the ARM Template
  1. Create a new file (vim storage.json), and paste in the contents of the storage.json file provided on the lab page.
Deploy the ARM Template in Complete Mode
  1. Deploy the resources in complete mode:

    $rg = '<RESOURCE_GROUP_IN_THE_LAB>'
    
    New-AzResourceGroupDeployment `
      -Mode Complete `
      -Name DeployStorage `
      -ResourceGroupName $rg `
      -TemplateFile './storage.json'
  2. Verify that the preexisting resources in the resource group have been deleted.

Additional Resources

You have been given credentials to log in to the Azure Portal. Within Cloud Shell, your objective will be to deploy an ARM template (provided below) into the existing resource group, using complete mode. All of the tasks can be completed within Cloud Shell, in a PowerShell session.

To complete this hands-on lab, please perform the following:

  • Log in to the Azure Portal with the credentials provided.
  • Open Cloud Shell and create persistent storage for your cloud drive (Storage Account and File Share).
  • Create a file named storage.json and paste the contents from below into that file.
  • Perform the necessary PowerShell commands to deploy the resources in that storage.json file into the existing resource group using complete mode.

Contents of storage.json file:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "storageAccountType": {
      "type": "string",
      "defaultValue": "Standard_LRS",
      "allowedValues": [
        "Standard_LRS",
        "Standard_GRS",
        "Standard_ZRS",
        "Premium_LRS"
      ],
      "metadata": {
        "description": "Storage Account type"
      }
    },
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "Location for all resources."
      }
    }
  },
  "variables": {
    "storageAccountName": "[concat('store', uniquestring(resourceGroup().id))]"
  },
  "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')]"
    }
  }
}

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!