Skip to content

got HTTP 400 error when calling WebSiteManagementClient.web_apps.install_site_extension() #2828

@APAC-DevOps

Description

@APAC-DevOps

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"
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    App ServicesMgmtThis issue is related to a management-plane library.RestAPIService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-author-feedbackWorkflow: More information is needed from author to address the issue.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamno-recent-activityThere has been no recent activity on this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions