PowerShell: 101-vm-simple-windows


Very simple deployment of a Windows VM

Description

This is a conversion of ARM template 101-vm-simple-windows  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 deploy a A2 size VM in the resource group location and return the fully qualified domain name of the VM, 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 there is already the specified resource group exists then the script will not continue with the deployment.

Syntax

Deploy-AzResources.ps1 [-resourceGroupName] <string> [-location] <string> [-adminUsername] <string> [-adminPassword] <securestring> [-dnsLabelPrefix] <string> [[-windowsOSVersion] <string>] [[-vmSize] <string>] [<CommonParameters>]

Example

I 💙 PS> $param = @{
>> resourceGroupName = 'simple-rg'
>> location = 'westus'
>> adminUsername = 'sysadmin'
>> dnsLabelPrefix = 'patnayakuni2020'
>> }

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

Output

cmdlet Deploy-AzResources.ps1 at command pipeline position 1
Supply values for the following parameters:
adminPassword: *************
Deployment is successful!
HostName: patnayakuni2020.westus.cloudapp.azure.com

Code

    View the code in GitHub  
Last modified: 21 August 2020

Share it on     |   |   |   | 
comments powered by Disqus