PowerShell: 101-vm-tags

Simple deployment of a VM with Tags


This is a conversion of ARM template 101-vm-tags  from the repository azure\azure-quickstart-templates  to PowerShell Script.

This script allows you to deploy a simple Windows VM using a few different options for the Windows version, using the latest patched version. This will include tags on the Virtual Machine, Storage Account, Public IP Address, Virtual Network, and Network Interface, and it will deploy the following resources…

… and in-addition to it, just in-case if the deployment is not successful, then it will rollback the entire deployment.


If the specified resource group is already exist then the script will not continue with the deployment.


Deploy-AzResource.ps1 [-ResourceGroupName] <string> [-Location] <string> [-AdminCredential] <pscredential> [[-DNSLabelPrefix] <string>] [[-WindowsOSVersion] <string>] [[-DepartmentName] <string>] [[-ApplicationName] <string>] [[-CreatedBy] <string>] [[-VMSize] <string>] [<CommonParameters>]


I 💙 PS> $Credential = Get-Credentials

PowerShell credential request
Enter your credentials.
User: sysadmin
Password for user sysadmin: *************

I 💙 PS> $param = @{
>> ResourceGroupName = 'test-rg'
>> Location = 'westus'
>> AdminCredential = $Credential
>> }

I 💙 PS> .\Deploy-AzResources.ps1 @param


Deployment is successful!


    View the code in GitHub  
Last modified: 31 August 2020

Share it on     |   |   |   | 
comments powered by Disqus