Skip to content

Instantly share code, notes, and snippets.

@CodeHeight
Created May 9, 2018 17:53
Show Gist options
  • Save CodeHeight/d409d5bfc0f3fe63ce2cfe2d214806d9 to your computer and use it in GitHub Desktop.
Save CodeHeight/d409d5bfc0f3fe63ce2cfe2d214806d9 to your computer and use it in GitHub Desktop.
Build and Deploy Private Virtual Machine
### Define Deployment Variables
{
$location = 'southcentralus'
$resourceGroupName = 'rg874826'
$resourceDeploymentName = 'contoso-iaas-deployment'
$templatePath = $env:SystemDrive + '\Users\LabUser\Documents\HOL_Lab_Files\3_Deploying_Virtual_Machines'
$templateFile = 'contosoIaaS_3.json'
$template = $templatePath + '\' + $templateFile
$password = "C0nts0sP@55"
$securePassword = $password | ConvertTo-SecureString -AsPlainText -Force
}
### Deploy Resources
{
$additionalParameters = New-Object -TypeName Hashtable
$additionalParameters['vmPrivateAdminPassword'] = $securePassword
New-AzureRmResourceGroupDeployment `
-Name $resourceDeploymentName `
-ResourceGroupName $resourceGroupName `
-TemplateFile $template `
@additionalParameters `
-Verbose -Force
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment