Open joanteixi opened 3 years ago
Please fully fill out the issue template. Without additional information, we will have to close the issue.
Bicep version Bicep CLI version 0.3.255
Describe the bug
I'm trying to create an automation account + runbook + schedules + link runbook and schedules. Every thing goes well but when I add automationAccounts/jobSchedules resource, I get a 404 error:
Here is the bicep file, that works perfect except when I add the jobSchedules resource:
https://raw.githubusercontent.com/joanteixi/az-bicep/master/start-stop-vm/automation.bicep
Thanks!
Use either parent
keyword, ${account.name}/
in the sub-resources name or explicitly put dependsOn
.
Without them, ARM tries to deploy all resources at once - there's no logical link between account and jobs.
Thanks for your help, I didn't know about parent/dependsOn keyword... but it didn't work. Now I understand better the order that the ARM templates are being deployed but it's still returning a 404 error:
resource startstop0600 'Microsoft.Automation/automationAccounts/jobSchedules@2020-01-13-preview' = {
name: 'start-0600'
parent: automation
dependsOn: [
daily_6
startstopRunbook
]
properties: {
schedule: {
name: '${daily_6.name}'
}
runbook: {
name: '${startstopRunbook.name}'
}
parameters: {
'action': 'start'
'rg': rg
'tagname': 'start-stop'
}
}
}
new bicep file at https://raw.githubusercontent.com/joanteixi/az-bicep/master/start-stop-vm/automation.bicep
Thanks for your help!
The dependsOn in the startstop0600
is unnecessary since you're using references to those objects, but it should not break anything.
Could you use bicep build
command (or copy it from resource group deployments section in Azure Portal) and paste the generated json?
I think I found what's wrong.
It seems like name of the jobSchedules must be a guid - you cannot put any name you want.
Following code worked for me:
resource startstop0600 'Microsoft.Automation/automationAccounts/jobSchedules@2019-06-01' = {
name: guid('start-0600')
parent: automation
properties: {
schedule: {
name: daily_6.name
}
runbook: {
name: startstopRunbook.name
}
parameters: {
action: 'start'
rg: rg
tagname: 'start-stop'
}
}
}
This is probably something to improve in REST api specs, that name must be a guid format.
It is a problem of ARM Template Runtime that the validation information of the string part is not provided in the schema. So at this point, it's not a bicep issue. Also, RP's poor error messages take my time. These are the reasons for the reduced productivity of the biceps.
I also lost time the other day due to poor RP error messages. https://github.com/Azure/bicep/pull/2206
If you know where to give feedback on ARM Template Runtime issues, please let me know.
If you know where to give feedback on ARM Template Runtime issues, please let me know.
I think this is the best place for ARM issues. I agree that it's not a bicep as a compiler issue, but it's still a bicep ecosystem one. Bicep Team is this same team that works on ARM.
As for this particular error, the 404 was not returned from ARM runtime but from the RP itself - notice that 404 is in the error body, while the error code is BadRequest
- which indicates that the payload is malformed.
For type inaccuracies Bicep Teams track it under Azure/bicep#784. You can also submit issue in https://github.com/Azure/azure-rest-api-specs or via your Support Plan.
Hi,
Thanks for bring me the solution... it's true that a jobSchedule don't have any string name and I remove the dependsOn array from the jobScheduler.
I'm gonna a close this issue, as it has been fixed.
Thanks you very much!
I think I found what's wrong.
It seems like name of the jobSchedules must be a guid - you cannot put any name you want.
Following code worked for me:
resource startstop0600 'Microsoft.Automation/automationAccounts/jobSchedules@2019-06-01' = { name: guid('start-0600') parent: automation properties: { schedule: { name: daily_6.name } runbook: { name: startstopRunbook.name } parameters: { action: 'start' rg: rg tagname: 'start-stop' } } }
This is probably something to improve in REST api specs, that name must be a guid format.
I got the same error and I think Microsoft should actually add more details about documentation for this.
I've experienced the same error with uninformative message:
ERROR: {"status":"Failed","error":{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"Conflict","message":"{\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"ResourceDeploymentFailure\",\r\n \"message\": \"The 'AzureAsyncOperationWaiting' resource operation completed with terminal provisioning state 'Failed'.\",\r\n \"details\": [\r\n {\r\n \"code\": \"DeploymentFailed\",\r\n \"message\": \"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.\",\r\n \"details\": [\r\n {\r\n \"code\": \"NotFound\",\r\n \"message\": \"{\\r\\n \\\"error\\\": {\\r\\n \\\"code\\\": \\\"BadRequest\\\",\\r\\n \\\"message\\\": \\\"\\\"\\r\\n }\\r\\n}\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n}"}]}}
The error was finally solved by using guid()
as mentioned above.
I want maintainer to improve error message and documentation.
Moved to Azure types repo, renamed, and re-opened. We will follow up with the provider to improve the error message.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jaspkaur28. Please see https://aka.ms/biceptypesinfo for troubleshooting help.
Author: | joanteixi |
---|---|
Assignees: | - |
Labels: | `inaccuracy`, `RP: Microsoft.Automation`, `Service Attention`, `Automation` |
Milestone: | - |
Bicep version Bicep CLI version 0.3.255
Describe the bug
I'm trying to create an automation account + runbook + schedules + link runbook and schedules. Every thing goes well but when I add automationAccounts/jobSchedules resource, I get a 404 error:
Here is the bicep file, that works perfect except when I add the jobSchedules resource:
https://raw.githubusercontent.com/joanteixi/az-bicep/master/start-stop-vm/automation.bicep
Thanks!