In this example, you run a script to deploy a virtual machine to Azure Stack Development Kit using a Resource Manager template. Before proceeding, ensure you have configured PowerShell

The VHD used in this example template is WindowsServer-2012-R2-Datacenter.

  1. Go to http://aka.ms/AzureStackGitHub, search for the 101-simple-windows-vm template, and save it to the following location: c:\templates\azuredeploy-101-simple-windows-vm.json.
  2. In PowerShell, run the following deployment script. Replace username and password with your username and password. On subsequent uses, increment the value for the $myNum parameter to prevent overwriting your deployment.
    PowerShellCopy
        # Set Deployment Variables
        $myNum = "001" #Modify this per deployment
        $RGName = "myRG$myNum"
        $myLocation = "local"
    
        # Create Resource Group for Template Deployment
        New-AzureRmResourceGroup -Name $RGName -Location $myLocation
    
        # Deploy Simple IaaS Template
        New-AzureRmResourceGroupDeployment `
            -Name myDeployment$myNum `
            -ResourceGroupName $RGName `
            -TemplateFile c:\templates\azuredeploy-101-simple-windows-vm.json `
            -NewStorageAccountName mystorage$myNum `
            -DnsNameForPublicIP mydns$myNum `
            -AdminUsername <username> `
            -AdminPassword ("<password>" | ConvertTo-SecureString -AsPlainText -Force) `
            -VmName myVM$myNum `
            -WindowsOSVersion 2012-R2-Datacenter
    
  3. Open the Azure Stack portal, click Browse, click Virtual machines, and look for your new virtual machine (myDeployment001).

Leave a Reply