Skip to content

Instantly share code, notes, and snippets.

@johnmmoss
Created July 19, 2018 14:53
Show Gist options
  • Save johnmmoss/ebeb5d4a9dd35b6eee19f8f749d91534 to your computer and use it in GitHub Desktop.
Save johnmmoss/ebeb5d4a9dd35b6eee19f8f749d91534 to your computer and use it in GitHub Desktop.
$subscription_id_test = "<guid>"
$ScriptPath = Split-Path $MyInvocation.InvocationName
$templateFile = "$ScriptPath\WebApi\WebSite.json" # Sample Azure Template
$name = "TestWebApi"
$hostPlan = "F1" # Defined in the parameters in template
write-host Importing azure module -ForegroundColor gray
Import-Module -Name AzureRM
write-host Connecting... -ForegroundColor gray
Connect-AzureRMAccount
write-host Selecting subscription -ForegroundColor gray
Select-AzureRmSubscription $subscription_id_test
$resourceGroup = read-host "ENTER Resource group name"
$resourceGroupLocation = read-host "ENTER Resource group name location"
write-host Creating resource group $resourceGroup
New-AzureRmResourceGroup -Name $resourceGroup -Location $ResourceGroupLocation -Verbose -Force
write-host Creating file from template $template -ForegroundColor gray
$parameters = @{}
$parameters.Add("hostingPlanName", $hostPlan)
New-AzureRmResourceGroupDeployment -Name $name -ResourceGroupName $resourceGroup -TemplateFile $templateFile -TemplateParameterObject $parameters -Force -Verbose #-ErrorVariable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment