Task failed: {"statusCode":201,"request":{"rawResponse":false,"queryString":{},"url":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Insights/components/myAppInsightInstance?api-version=2015-05-01","method":"PUT","headers":{"Content-Type":"application/json; charset=utf-8","x-ms-client-request-id":"9f2175e0-ac45-4b31-8f69-abfc1380babb","accept-language":"en-US","user-agent":"Node/v6.10.3 (x64-Windows_NT-10.0.14393) ms-rest/2.3.6 ms-rest-azure/2.5.7 azure-arm-appinsights/1.2.1-preview Azure-SDK-For-Node"},"body":"{\"location\":\"East US\",\"kind\":\"web\",\"properties\":{\"Application_Type\":\"web\",\"Flow_Type\":\"Bluefield\",\"Request_Source\":\"rest\"}}"},"response":{"body":"{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/microsoft.insights/components/myAppInsightInstance\",\"name\":\"myAppInsightInstance\",\"type\":\"microsoft.insights/components\",\"location\":\"eastus\",\"tags\":{},\"kind\":\"web\",\"etag\":\"\\\"3500efa2-0000-0000-0000-5b755af40000\\\"\",\"properties\":{\"ApplicationId\":\"myAppInsightInstance\",\"AppId\":\"5bd602db-dba2-445c-8459-bb81a178d39a\",\"Application_Type\":\"web\",\"Flow_Type\":\"Bluefield\",\"Request_Source\":\"rest\",\"InstrumentationKey\":\"01234567-8901-2345-9789-012345678901\",\"Name\":\"appInsightInstance\",\"CreationDate\":\"2017-08-28T21:20:16.5967817+00:00\",\"PackageId\":null,\"TenantId\":\"65867574-7606-4e35-8178-634654445ed1\",\"HockeyAppId\":null,\"HockeyAppToken\":null,\"provisioningState\":\"Succeeded\",\"SamplingPercentage\":null,\"CustomMetricsOptedInType\":null}}","headers":{"cache-control":"no-cache","pragma":"no-cache","content-length":"833","content-type":"application/json; charset=utf-8","expires":"-1","x-content-type-options":"nosniff","strict-transport-security":"max-age=31536000; includeSubDomains","x-ms-ratelimit-remaining-subscription-writes":"1197","server":"Microsoft-IIS/8.5","x-powered-by":"ASP.NET","x-ms-request-id":"669d014a-9fa4-4752-8cab-1ad4953d87f3","x-ms-correlation-request-id":"669d014a-9fa4-4752-8cab-1ad4953d87f3","x-ms-routing-request-id":"SOUTHCENTRALUS:20180816T110732Z:669d014a-9fa4-4752-8cab-1ad4953d87f3","date":"Thu, 16 Aug 2018 11:07:31 GMT","connection":"close"},"statusCode":201},"body":{}} { Error: {"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/microsoft.insights/components/myAppInsightInstance","name":"myAppInsightInstance","type":"microsoft.insights/components","location":"eastus","tags":{},"kind":"web","etag":"\"3500efa2-0000-0000-0000-5b755af40000\"","properties":{"ApplicationId":"myAppInsightInstance","AppId":"5bd602db-dba2-445c-8459-bb81a178d39a","Application_Type":"web","Flow_Type":"Bluefield","Request_Source":"rest","InstrumentationKey":"01234567-8901-2345-6789-012345678901","Name":"myAppInsightInstance","CreationDate":"2017-08-28T21:20:16.5967817+00:00","PackageId":null,"TenantId":"65867574-7606-4e35-8178-634654445ed1","HockeyAppId":null,"HockeyAppToken":null,"provisioningState":"Succeeded","SamplingPercentage":null,"CustomMetricsOptedInType":null}}
at client.pipeline.error (c:\1\_tasks\ProvisionMicroservice_a314f061-de3d-42c6-b716-846ad1b9a1b5\0.0.19\node_modules\azure-arm-appinsights\lib\operations\components.js:715:19)
at retryCallback (c:\1\_tasks\ProvisionMicroservice_a314f061-de3d-42c6-b716-846ad1b9a1b5\0.0.19\node_modules\azure-arm-appinsights\node_modules\ms-rest\lib\filters\systemErrorRetryPolicyFilter.js:89:9)
at retryCallback (c:\1\_tasks\ProvisionMicroservice_a314f061-de3d-42c6-b716-846ad1b9a1b5\0.0.19\node_modules\azure-arm-appinsights\node_modules\ms-rest\lib\filters\exponentialRetryPolicyFilter.js:140:9)
at c:\1\_tasks\ProvisionMicroservice_a314f061-de3d-42c6-b716-846ad1b9a1b5\0.0.19\node_modules\azure-arm-appinsights\node_modules\ms-rest\lib\filters\rpRegistrationFilter.js:59:14
at handleRedirect (c:\1\_tasks\ProvisionMicroservice_a314f061-de3d-42c6-b716-846ad1b9a1b5\0.0.19\node_modules\azure-arm-appinsights\node_modules\ms-rest\lib\filters\redirectFilter.js:39:9)
at c:\1\_tasks\ProvisionMicroservice_a314f061-de3d-42c6-b716-846ad1b9a1b5\0.0.19\node_modules\azure-arm-appinsights\node_modules\ms-rest\lib\filters\formDataFilter.js:23:14
at Request.defaultRequest [as _callback] (c:\1\_tasks\ProvisionMicroservice_a314f061-de3d-42c6-b716-846ad1b9a1b5\0.0.19\node_modules\azure-arm-appinsights\node_modules\ms-rest\lib\requestPipeline.js:125:16)
at Request.self.callback (c:\1\_tasks\ProvisionMicroservice_a314f061-de3d-42c6-b716-846ad1b9a1b5\0.0.19\node_modules\azure-arm-appinsights\node_modules\request\request.js:185:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
Clearly this is generated code using AutoRest and probably based off a Swagger JSON file. It is clear that this code is expecting a 200 result and not a 201 as the call stack indicates.
Using package
azure-arm-appinsights
version1.2.1-preview
and the following call now fails:See following callstack:
Looking at the source code, this pointed us to lines 714-715 of the following file: https://github.com/Azure/azure-sdk-for-node/blob/master/lib/services/applicationinsights/lib/operations/components.js
Clearly this is generated code using AutoRest and probably based off a Swagger JSON file. It is clear that this code is expecting a 200 result and not a 201 as the call stack indicates.
Looking at the Rest API doc (here: https://docs.microsoft.com/en-us/rest/api/application-insights/components/createorupdate) it is clear that a 200 OK should be returned.
It seems like the behavior was changed.
Has anyone else hit this issue?