I'm attempting to use Azure App Service Environments (ASE) and I'm having difficulty creating App Service Plans (ASP) within the ASE using Powershell. I've attempted to do so using New-AzureResource
and New-AzureResourceGroupDeployment
cmdlets and both fail in unhelpful ways. I need to be able to create these programmatically for our CI provisioning and deployment process (using TeamCity).
I created the ASE manually since they take 3+ hours to spin up (sidenote: why, Microsoft, why does it take 3+ hours to do anything with an ASE?), and defined worker pool 1 as a two-node P1 pool.
Then with judicious use of the http://resources.azure.com tool I was able to extract the properties defining an ASP.
So I then created a simple template for the new ASP:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"apiVersion": "2015-06-01",
"name": "rg-ase-dev-asp-wp1-2",
"type": "Microsoft.Web/serverfarms",
"location": "East US",
"properties": {
"name": "rg-ase-dev-asp-wp1-2",
"sku": "Premium",
"workerSize": 0,
"numberOfWorkers": "1",
"hostingEnvironmentId": "[resourceId('Microsoft.Web/hostingEnvironments',parameters('rg-ase-dev'))]"
}
}
]
}
Then using the template:
reResourceGroup1\Templates> New-AzureResourceGroupDeployment -ResourceGroupName
"rg-ase-dev" -TemplateFile .\ase_asp_only.json -Verbose
VERBOSE: 12:37:28 PM - Template is valid.
VERBOSE: 12:37:29 PM - Create template deployment 'ase_asp_only'.
VERBOSE: 12:37:36 PM - Resource Microsoft.Web/serverfarms
'rg-ase-dev-asp-wp1-2' provisioning status is running
This command will fail continually (i.e. it will generate deployment failure notifications in the Preview Portal) for several hours until, I imagine, it gets killed off by the Azure backend.
I've tried most all combinations of ASP property values for the template and none work. I've also tried creating an ASP and a dependent WebApp in the same template, thinking that since ASPs can only exist if they've a webapp bound to them, that was my problem. That too failed.
Has anyone gotten templated ASP deployments working? Or is this even a supported operation?
So, no surprise here, the utter lack of documentation for Azure wastes yet more of my time.
The issue was the apiVersion for the ASE resource. You cannot use the latest, it looks like the version is resource specific, but it also looks like it only matters if you're creating a new resource, so you'll get inconsistent results depending on the operation.
Also concerning is that the template validates just fine, but the actual deployment simply hangs. If you run into a hanging deployment that acts something like this, check your apiVersion:
PS C:\Templates> New-AzureResourceGroupDeployment -ResourceGroupName
"rg-ase-dev" -TemplateFile .\ase_asp_only.json -Verbose
VERBOSE: 12:08:24 PM - Template is valid.
VERBOSE: 12:08:25 PM - Create template deployment 'ase_asp_only'.
VERBOSE: 12:08:27 PM - Resource Microsoft.Web/serverFarms
'rg-ase-dev-asp-wp1-2' provisioning status is running
(this hangs)
AFAICT, ARMExplorer appears to give a valid apiVersion in the link to the resource, so I'll stick to working with those versions until Microsoft inevitably breaks that as well.
What a PITA.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With