Description
openedon Feb 10, 2021
hi,
With Azure nextGen, I build a windows App Service Plan. and webapp, I want to activate an extension (here dynatrace, same problem with others).
All resources are created correctly unless extension
I've got this error
(Code = "Failed" Message = "The async operation failed).
I test with an ARM template and it worked. I based my pulumi code on the ARM template.
Steps to Reproduce
Pulumi code
Just WebAppSiteExtension
doesn't work
(Code = "Failed" Message = "The async operation failed).
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * as web_v20200901 from "@pulumi/azure-nextgen/web/v20200901";
import * as web_v20181101 from "@pulumi/azure-nextgen/web/v20181101";
// Create an Azure Resource Group
export const rg = new azure.core.ResourceGroup(`rg-demo-webapp-java`, {
name : `rg-demo-webapp-java-dev`,
});
//--------------------------------------------------------------------------
// Create Azure Web APP (App Service Plan Windows) | Provider Azure-NextGen
//--------------------------------------------------------------------------
// App Service Plan = ServerFarm
const appServicePlanWindows = new web_v20200901.AppServicePlan("asp-webbapp-w-java", {
name: `asp-webbapp-w-java-dev`,
resourceGroupName: rg.name,
location: rg.location,
kind: "app",
sku: {
name: "S1",
tier: "Standard",
size: "S1",
family: "S",
capacity: 1,
},
});
const appDemoWindows = new web_v20181101.WebApp(`demo-webapp-w-java`, {
resourceGroupName: rg.name,
location: appServicePlanWindows.location,
name: `demo-webapp-w-java-dev`,
serverFarmId: appServicePlanWindows.id,
siteConfig: {
appSettings: [ //Env Var
{
name: "VAR",
value: "test"
},
],
// Runtime
javaVersion: "11",
javaContainer: "JAVA",
javaContainerVersion: "SE",
alwaysOn: true,
}
});
const extDynatrace = new web_v20181101.WebAppSiteExtension('dynatrace-siteExtension',{
resourceGroupName: rg.name,
name: appDemoWindows.name,
siteExtensionId: "Dynatrace"
})
Template ARM that work
In this ARM, i create only extension on previously resource created
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"sites_demo_webapp_w_java_dev_name": {
"defaultValue": "demo-webapp-w-java-dev",
"type": "String"
},
"serverfarms_asp_webbapp_w_java_dev_externalid": {
"defaultValue": "/subscriptions/<sub-id>/resourceGroups/rg-demo-webapp-java-dev/providers/Microsoft.Web/serverfarms/asp-webbapp-w-java-dev",
"type": "String"
}
},
"variables": {},
"resources": [{
"type": "Microsoft.Web/sites/siteextensions",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('sites_demo_webapp_w_java_dev_name'), '/Dynatrace')]",
"location": "France Central"
}]
}
AZURE API REST
We see this issues Azure/azure-rest-api-specs#2819
As suggested by @hovsepm here, Azure SDK calls fail to create site extensions when they attempt to PUT a request with null content. Setting request body to an empty JSON object ({}) fixes the problem.
so we test it and voila, if you leave your body empty, it doesn't work,
but if you put {}, it's work !
if this can help you to solved it ;)
Context (Environment)
Azure France Central
@pulumi/azure@3.46.0
@pulumi/azure-nextgen@0.6.0
@pulumi/pulumi@2.20.0
@types/node@10.17.51