Azure / Azure/azure-powershell

Az Deployment errors need improvement

Open
#14,283 6 comments 0 reactions 0 assignees View on GitHub
act-identity-squad ARM customer-reported needs-team-attention question Service Attention
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.