Skip to content

Az Deployment errors need improvement #14283

Open
@slavizh

Description

@slavizh

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

New-AzDeployment

Environment data


Module versions

Az.Resources 3.2.1

Debug output

N/A

Error output

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    ARMService AttentionThis issue is responsible by Azure service team.customer-reportedneeds-team-attentionThis issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions