-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get-AzureRmResource followed by Set-AzureRmResource changing JSON data type #7930
Comments
@jsheetzati would you mind providing the debug output after running both commands with |
@cormacpayne I have the debug log that illustrates the issue for you. Unfortunately, due to contractual obligations, I am not able to share publicly. I can send you the gist link if that is okay with you. My email is in my profile. Thanks! |
@cormacpayne I scrubbed the log to remove our personal information that we cannot share. I hope it helps. https://gist.github.com/jsheetzati/bfdf89ba9fd6391f4e22c532f3cd2e2d Edit: "equals": [
"@outputs('SubmitParseCsvFileJob')['statusCode']",
200
] "equals": [
"@outputs('SubmitParseCsvFileJob')['statusCode']",
"200"
] |
@jsheetzati I'm unable to reproduce this when using the latest $definition = (Get-Content -Raw -Path "jsonFile.json") | ConvertFrom-Json It may be the case that the |
Here is a sample json file + powershell script that I am running. Confirmed it is still an issue with Az 1.3.0. I added some logging on one of the properties right before SetAzResource. After SetAzResource, I retrieve the resource again and the type is now a string. Output from running script with json file: LogicApp,json {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Condition": {
"actions": {
"Terminate": {
"inputs": {
"runError": {
"message": "Counter is string"
},
"runStatus": "Failed"
},
"runAfter": {},
"type": "Terminate"
}
},
"else": {
"actions": {
"Terminate_2": {
"inputs": {
"runStatus": "Succeeded"
},
"runAfter": {},
"type": "Terminate"
}
}
},
"expression": {
"and": [
{
"equals": [
"@variables('counter')",
"1"
]
}
]
},
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "If"
},
"Initialize_variable": {
"inputs": {
"variables": [
{
"name": "counter",
"type": "Integer",
"value": 1
}
]
},
"runAfter": {},
"type": "InitializeVariable"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"Recurrence": {
"recurrence": {
"frequency": "Week",
"interval": 1
},
"type": "Recurrence"
}
}
}
} Powershell Script $ResourceName = "LogicAppResourceName"
$ResourceGroupName = "ResourceGroup"
Write-Host "Updating $($ResourceName)"
$resource = Get-AzResource -ResourceGroupName $ResourceGroupName -name $ResourceName -ResourceType Microsoft.Logic/workflows
if (!$resource) {
throw "No resource found"
}
$definitionAsJson = (Get-Content -Raw -Path "LogicApp.json")
if (!$definitionAsJson) {
throw "Unable to read json file for $($logicApp)"
}
$definition = $definitionAsJson | ConvertFrom-Json
$resource.Properties.definition = $definition.definition
try {
Write-Host $resource.Properties.definition.actions.Initialize_variable.inputs.variables[0].value.GetType().Name
$resource | Set-AzResource -Force -ErrorAction Stop | Out-Null
Write-Host "Updated $($resourceName)"
$updateResource = Get-AzResource -ResourceGroupName $ResourceGroupName -name $ResourceName -ResourceType Microsoft.Logic/workflows
Write-Host $updateResource.Properties.definition.actions.Initialize_variable.inputs.variables[0].value.GetType().Name
} catch {
throw $_
}
Write-Host "done" |
@jsheetzati thanks for going through the work of getting this extra information. I was able to reproduce this exception and track down where the issue is coming from:
We will look at a fix for this in an upcoming release. |
Awesome. Will this fix be applied to both Az and AzureRm? |
@jsheetzati this fix would only be applied to |
Fix for this issue can be found in PR #8593 |
Sounds good. Thanks for resolving this! |
The fix for this will be available in the upcoming release of |
Description
We are using Get-AzureRmResource and Set-AzureRmResource to automate some logic app deployments. When running the script, Set-AzureRmResource is turning numeric and boolean data types into strings. This looks very similar to this issue: #5940
For example, in our logic app definition json file, we have the following chunk of json:
After piping the resource into Set-AzureRmResource, we end up with the following in the Portal:
This is just one example of a data type changing but it happens many times within the logic app definition when deploying in this manner.
Script/Steps for Reproduction
If you need the full script illustrating the issue, I am more than happy to provide.
Module Version
6.13.1
Environment Data
PSVersion 5.1.17134.228
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17134.228
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Debug Output
Very long.. can provided if needed.
The text was updated successfully, but these errors were encountered: