-
Notifications
You must be signed in to change notification settings - Fork 759
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
Bicep file errors are not mapped from ARM deployment errors #855
Comments
To do this for powershell, we need to resolve any line number inconsistency issues. There may be other issues in CLI to resolve. |
@shenglol @alex-frankel Is there a timeline for this issue? This would be helpful for ARM Template Analyzer (https://github.com/Azure/template-analyzer) to map problems back to the bicep. |
@norbusonam -- no timeline atm. TBH, it hasn't emerged as significant of an issue as we had predicted, so it is not currently high on the priority list. |
I've run into this because of a non-obvious user error using |
I've generally found that the line number given in ARM errors is always 1 as though the template itself is flattened. I've been unable to find anything about what is happening with the template on Azure's side (from which to discern how to make sense of the line position it points to as the source of the error). @alex-frankel do you know of anything published in this regard? |
There is some unfortunate formatting that sometimes happens in Az PS and Az CLI as a result of the JSON libraries we use. The template is getting stripped of white space prior to being sent to ARM. What the ARM Deployments engine sees is the entire template in one line, hence this result. We have a work item to get it resolved, but it hasn't been prioritized. To be transparent, our ability to emit accurate position info in our errors is mediocre even if the template formatting is not disturbed. We need to revisit the capability entirely in order to deliver something meaningful. |
Another place I think this can happen is if the error occurs when the deployment engine is processing a nested template (Bicep module). I believe the deployment engine reformats nested deployments before processing them, leading to whitespace information being lost. |
Simple example (don't choose a parameter file): param location string produces this: 4:47:25 PM: Starting deployment of /private/var/folders/xz/0qvk9_592r1f_y5l3py0m_b00000gn/T/main.bicep
4:47:25 PM: Scope specified in main.bicep -> resourceGroup
4:48:03 PM: No parameter file was provided
4:48:05 PM: Deployment failed for /private/var/folders/xz/0qvk9_592r1f_y5l3py0m_b00000gn/T/main.bicep. Deployment template validation failed: 'The value for the template parameter 'location' at line '1' and column '293' is not provided. Please see https://aka.ms/resource-manager-parameter-files for usage details.'.
Status: 400 (Bad Request)
ErrorCode: InvalidTemplate
Content:
{"error":{"code":"InvalidTemplate","message":"Deployment template validation failed: 'The value for the template parameter 'location' at line '1' and column '293' is not provided. Please see https://aka.ms/resource-manager-parameter-files for usage details.'.","additionalInfo":[{"type":"TemplateViolation","info":{"lineNumber":1,"linePosition":293,"path":"properties.template.parameters.location"}}]}}
Headers:
Cache-Control: no-cache
Pragma: no-cache
x-ms-failure-cause: REDACTED
x-ms-ratelimit-remaining-subscription-writes: REDACTED
x-ms-request-id: 70cc47a3-20c2-4610-ac55-281ee6f296cc
x-ms-correlation-request-id: REDACTED
x-ms-routing-request-id: REDACTED
Strict-Transport-Security: REDACTED
X-Content-Type-Options: REDACTED
Date: Wed, 30 Mar 2022 23:48:04 GMT
Content-Type: application/json; charset=utf-8
Expires: -1
Content-Length: 402 |
Will become more important once the
.bicep
file extension is natively supported in Az PS/CLI commandsThe text was updated successfully, but these errors were encountered: