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.
Note:
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!