-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
I have a python function which does Azure Web App service deployment along with the extension AspNetCore. If I commented out the lines for installing site extension, my script ran happily; however, with the lines for AspNet Core extension installation, my script can not run successfully.
If I do the manual installation via Azure Portal, then, I can complete the extension installation successfully. I wrote ARM templates with site and extension provision, again, my code runs happily. But calling WebSiteManagementClient.web_apps.install_site_extension() like below doesn't work, and I got
msrestazure.azure_exceptions.CloudError: 400 Client Error: Bad Request for url: https://management.azure.com/subscriptions/XXXXX(sensitive info)/siteextensions/AspNetCoreRuntime?api-version=2016-08-01
can you take a look and see if I missed anything here?
ARM Template
{
"apiVersion": "2015-08-01",
"name": "[parameters('siteName')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('location')]",
"properties": {
"name": "[parameters('siteName')]",
"serverFarmId": "[parameters('appServicePlanId')]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
],
"properties": {
"phpVersion": "off",
"netFrameworkVersion": "v4.0",
"webSocketsEnabled": true,
"requestTracingEnabled": true,
"httpLoggingEnabled": true,
"logsDirectorySizeLimit": 40,
"detailedErrorLoggingEnabled": true,
"scmType": "LocalGit"
}
},
{
"apiVersion": "2016-08-01",
"name": "AspNetCoreRuntime",
"type": "siteextensions",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
],
"properties": {}
}
]
}
Python Code
def deploy_app_service():
print("\nDeploying App Service To Resource Group\n")
AzureServicePrincipalcredentials = ServicePrincipalCredentials(
client_id = my_azure_client_id,
secret = my_azure_secret_id,
tenant = my_azure_tenant_id
)
web_client = WebSiteManagementClient(AzureServicePrincipalcredentials, my_subscription_id)
site_async_operation = web_client.web_apps.create_or_update(
my_rg_name,
"jianhuafirstWebApp",
{
'location': my_location,
'server_farm_id': my_service_plan_id,
'reserved': False,
'enabled': True,
'kind': 'app',
'site_config': {
"kind": "web",
"phpVersion": "off",
"netFrameworkVersion": "v4.0",
"webSocketsEnabled": True,
"logsDirectorySizeLimit": 40,
"requestTracingEnabled": True,
"httpLoggingEnabled": True,
"detailedErrorLoggingEnabled": True,
"scmType": "LocalGit"
}
}
)
install site extension
my_site_extension = web_client.web_apps.install_site_extension(
my_rg_name,
"jianhuafirstWebApp",
"AspNetCoreRuntime"
)