Skip to content

Instantly share code, notes, and snippets.

@CodeHeight
Created May 8, 2018 19:43
Show Gist options
  • Save CodeHeight/171c0e91acbabec24c3fa34c8a36751d to your computer and use it in GitHub Desktop.
Save CodeHeight/171c0e91acbabec24c3fa34c8a36751d to your computer and use it in GitHub Desktop.
Deploy a PaaS Resource
### Define Deployment Variables
{
$resourceGroupName = 'rg553710'
$resourceProviderNamespace = 'Microsoft.Web'
$resourceTypeName = 'sites'
$resourceGroupLocation = 'southcentralus'
$randomString = ([char[]]([char]'a'..[char]'z') + 0..9 | Sort-Object {Get-Random})[0..8] -join ''
$appNamePrefix = 'contoso'
$appServicePlanName = $appNamePrefix + $randomString
$webAppName = $appNamePrefix + $randomString
}
### Create App Service Plan
{
$appServicePlan = New-AzureRmAppServicePlan `
-ResourceGroupName $resourceGroupName `
-Location $resourceGroupLocation `
-Name $appServicePlanName `
-Tier Standard `
-WorkerSize Small `
-Verbose
}
### Create Web App
{
New-AzureRmWebApp `
-ResourceGroupName $resourceGroupName `
-Location $resourceGroupLocation `
-AppServicePlan $appServicePlan.ServerFarmWithRichSkuName `
-Name $webAppName `
-Verbose
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment