New-AzureRmLogicApp: The integration account id must be provided in the 'integrationAccount' property of the workflow
Cmdlet(s)
New-AzureRmLogicApp
PowerShell Version
5.1.14393.1884
Module Version
Get-Command New-AzureRMLogicApp
CommandType Name Version Source Cmdlet New-AzureRmLogicApp 4.0.0 AzureRM.LogicApp
OS Version
10.0.14393.1884
Description
Note: I'm not sure whether this fault is with the PowerShell CMDlets or the underlying SDK.
Running the command:
New-AzureRmLogicApp -ResourceGroupName "{redacted}" -Name "test" -Location "West Europe" -DefinitionFilePath app.json -IntegrationAccountId "/subscriptions/{redacted}/resourceGroups/{redacted/providers/Microsoft.Logic/integrationAccounts/test"
errors with
New-AzureRmLogicApp : The integration account id must be provided in the 'integrationAccount' property of the workflow 'test'.
This is the definition I've put together to demonstrate this issue, the same thing happens with more complete definitions.
{
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"triggers": {},
"actions": {},
"outputs": {}
}
In the debug output, you can see that for the request to the logic app API the integration account property seems to not be properly set.
"integrationAccount": {}
should presumably be
"integrationAccount": { "id": "theid"}
There might be something else at play, but it seems that this might due to a problem with JSON serialization?
Debug Output
HTTP Method:
PUT
Absolute Uri:
https://management.azure.com/subscriptions/{redacted}/resourceGroups/{redacted}/providers/Microsoft
.Logic/workflows/test?api-version=2016-06-01
Headers:
x-ms-client-request-id : 0c9e3c93-81e8-450b-9405-a90cdff77b35
accept-language : en-US
Body:
{
"properties": {
"state": "Enabled",
"integrationAccount": {},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"triggers": {},
"actions": {},
"outputs": {}
}
},
"location": "West Europe"
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
BadRequest
Headers:
Pragma : no-cache
x-ms-request-id : westeurope:6d4a66a4-0530-4d60-ba50-3b24bcb5e58a
Strict-Transport-Security : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-writes: 1196
x-ms-correlation-request-id : 3af26936-f021-4bff-857b-bf107a84645b
x-ms-routing-request-id : UKWEST:20180105T105016Z:3af26936-f021-4bff-857b-bf107a84645b
Cache-Control : no-cache
Date : Fri, 05 Jan 2018 10:50:15 GMT
Body:
{
"error": {
"code": "InvalidRequestContent",
"message": "The integration account id must be provided in the 'integrationAccount' property of the workflow 'test'."
}
}
Script/Steps for Reproduction
New-AzureRmResourceGroup -Name "{redacted}" -Location "West Europe"
New-AzureRmIntegrationAccount -ResourceGroupName "{redacted}" -Name "test" -Location "West Europe" -Sku "Standard"
New-AzureRmLogicApp -ResourceGroupName "{redacted}" -Name "test" -Location "West Europe" -DefinitionFilePath app.json -IntegrationAccountId "/subscriptions/{redacted}/resourceGroups/{redacted}/providers/Microsoft.Logic/integrationAccounts/test"
Having dug into this a little further, I think the fault lies with the azure-rest-api-specs
https://github.com/Azure/azure-rest-api-specs/blob/ded42c8765ce911f777031cca04543332e164766/specification/logic/resource-manager/Microsoft.Logic/stable/2016-06-01/logic.json#L3158-L3165
defines the resource id as readonly, which results in the generated code missing a public setter, causing it not to be serialised
https://github.com/Azure/azure-sdk-for-net/blob/3bd40fa47229b3a9163ffefc05cbc5f591c85f51/src/SDKs/Logic/Management.Logic/Generated/Models/ResourceReference.cs#L44
From what I can, the readonly property either needs to be false / not set for the resourcereference type, or maybe a new type could be created for the the integrationaccount property if other types rely on the ResourceReference id being readonly?
I hope this helps
@scottrangerio Hey Scott, thanks for investigating this issue and providing a ton of valuable information!
@pankajsn @daviburg would you mind taking a look at this issue?
@pankajsn @daviburg would you mind taking a look at this issue?
This issue exists on Set-AzureRmLogicApp too
:bell: Routing this issue to @act-observability-squad.