Azure / Azure/azure-powershell
Az Deployment errors need improvement
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
## Description
I have noticed that when I do deployment with New-AzDeployment I can get the following error:
```
Error: 10:11:51 - Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'Template parameter JToken type is not valid. Expected 'Object'. Actual 'String'. Please see https://aka.ms/resource-manager-parameter-files for usage details.'.
```
The error does not hint where the problem is. If we look at the activity log for the same error we actually see more detailed error message:
```
"statusMessage": "{\"error\":{\"code\":\"InvalidTemplate\",\"message\":\"Deployment template validation failed: 'Template parameter JToken type is not valid. Expected 'Object'. Actual 'String'. Please see https://aka.ms/resource-manager-parameter-files for usage details.'.\",\"additionalInfo\":[{\"type\":\"TemplateViolation\",\"info\":{\"lineNumber\":5,\"linePosition\":30,\"path\":\"parameters.approvedLocations\"}}]}}",
```
Az deployments should include the full error so you can troubleshoot easier and do not have to go to activity log.
## Steps to reproduce
```powershell
New-AzDeployment
```
## Environment data
```
```
## Module versions
```powershell
Az.Resources 3.2.1
```
## Debug output
N/A
## Error output
N/A
Contributor guide
Assessment
This issue has not been assessed yet.