When running this command: Write-APIManagementTemplates -OutputDirectory "C:\Users\me\someplaceonmymachine" -SeparatePolicyFile $true -SeparateSwaggerFile $true -GenerateParameterFiles $true -AlwaysAddPropertiesAndBackend $true
I get this error: Write-APIManagementTemplates : Cannot cast Newtonsoft.Json.Linq.JObject to Newtonsoft.Json.Linq.JToken
This only happens when I refer to a Backend by id. It doesn't seem to matter which Backend type or cert etc.
I tried creating a minimal repro, but of course it is not complete since then the extractor won't work. If you wish to use it, make sure to add <set-backend-service backend-id="Test" /> in the <inbound>-block: repro.zip.
Further, it seems that this issue only occurs when I combine AlwaysAddPropertiesAndBackend and GenerateParameterFiles. If either is missing, the script proceeds just fine. Admittedly, I haven't looked deeply into what these parameters actually do. Particularily AlwaysAddPropertiesAndBackend might be misused here, but since there is no validation rule stopping me, and I up until now have just been mindlessly using what a colleague offered me, it took a fair share of troubleshooting to reach this state.
Hope this issue is clear and actionable. If not, let me know if I can provide any further information.
When running this command:
Write-APIManagementTemplates -OutputDirectory "C:\Users\me\someplaceonmymachine" -SeparatePolicyFile $true -SeparateSwaggerFile $true -GenerateParameterFiles $true -AlwaysAddPropertiesAndBackend $true
I get this error:
Write-APIManagementTemplates : Cannot cast Newtonsoft.Json.Linq.JObject to Newtonsoft.Json.Linq.JToken
This only happens when I refer to a Backend by id. It doesn't seem to matter which Backend type or cert etc.
I tried creating a minimal repro, but of course it is not complete since then the extractor won't work. If you wish to use it, make sure to add
<set-backend-service backend-id="Test" />
in the<inbound>
-block: repro.zip.Further, it seems that this issue only occurs when I combine
AlwaysAddPropertiesAndBackend
andGenerateParameterFiles
. If either is missing, the script proceeds just fine. Admittedly, I haven't looked deeply into what these parameters actually do. ParticularilyAlwaysAddPropertiesAndBackend
might be misused here, but since there is no validation rule stopping me, and I up until now have just been mindlessly using what a colleague offered me, it took a fair share of troubleshooting to reach this state.Hope this issue is clear and actionable. If not, let me know if I can provide any further information.