Skip to content
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

nextstagepropertiesjson Parameter could not be deserialized #3

Closed
disbenovi opened this issue Apr 17, 2024 · 6 comments
Closed

nextstagepropertiesjson Parameter could not be deserialized #3

disbenovi opened this issue Apr 17, 2024 · 6 comments
Assignees

Comments

@disbenovi
Copy link

Hello

Followed all the instructions, the automation account Managed Identity has the correct permissions on the Sub level.
When passing the nextstagepropertoesjson parameter on the runbook, an exception is thrown out:

The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: 7:10:52 PM - Error: Code=InvalidRequestContent; Message=The request content was invalid and could not be deserialized: 'Unexpected initial token 'String' when populating object. Expected JSON object or array. Path 'properties.template.resources.CliXml', line 7, position 6847.'.

image

The output seems to show that the parameters do get converted and read as the output shows the stagename :
image

However it just abruptly stops, and throws the exception.

The runtime environment is 5.1 for the Az modules, and the Powershell runbook.

@helderpinto
Copy link
Owner

Hi, @disbenovi! Can you please share the values that were passed to the Input Parameters? See example below

image

@helderpinto helderpinto self-assigned this Apr 17, 2024
@disbenovi
Copy link
Author

Here it is!
image

In text -

[
{
"stageName": "TEST_Wed_2200",
"offsetDays": 1,
"scope": ["/subscriptions/"],
"filter": {
"resourceTypes": [
"microsoft.compute/virtualmachines",
"microsoft.hybridcompute/machines"
],
"resourceGroups": [],
"tagSettings": {
"tags": {
"os-name": ["windows2022"],
"aum-stage": ["TEST"]
},
"filterOperator": "All"
},
"locations": [],
"osTypes": ["Windows"]
}
},
{
"stageName": "PROD_Thur_2200",
"offsetDays": 2,
"scope": ["/subscriptions/
*"],
"filter": {
"resourceTypes": [
"microsoft.compute/virtualmachines",
"microsoft.hybridcompute/machines"
],
"resourceGroups": [],
"tagSettings": {
"tags": {
"os-name": ["windows2022"],
"aum-stage": ["PRD"]
},
"filterOperator": "All"
},
"locations": [],
"osTypes": ["Windows"]
}
}
]

@helderpinto

@helderpinto
Copy link
Owner

I am not seeing anything obviously wrong or prone to failure. Allow me some time to try to reproduce your issue. I'll return to you with the results soon.

@disbenovi
Copy link
Author

Appreciate it :)

@helderpinto
Copy link
Owner

helderpinto commented Apr 19, 2024

I was able to reproduce this issue. There was a change in a recent version of the Az.Resources module, in the way it processes ARM template object (as hashtables), that broke the runbook code. I pushed a new version of the runbook that uses a different approach for the ARM template deployment. Please, update your runbook code and give it a new try.

Don't forget to increase the stages offsets, because they refer to the date of the latest run of the maintenance configuration and if you keep 1-2 days offsets, the resulting date will be in the past and the deployment will fail.

If the runbook still fails for the same reason, please reopen the issue.

@disbenovi
Copy link
Author

Works now, thanks a lot for the prompt responses @helderpinto!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants