Skip to content

Deployment failed: Mandatory parameters are missing - Paramter file not referenced properly #8

@stripesoc

Description

@stripesoc

I am using the default parameter mapping whereby my parameter files for my deployment templates share the same name except they are suffixed with .parameters.json. E.g.:

CosmosDb-Connection.json
CosmosDb-Connection.parameters.json

The way that the deployment script works is it looks for a parameter file 3 ways: through the sentinel-deployment.config file, via a workspace parameter file or via a default parameter file. I am using the default parameter file method.

In the function GetParameterFile it gets the parameter file name by:

  1. Getting the path of the deployment
  2. Attempting to remove the .json at the end of the file name
  3. Fixing .parameters.json

It then uses the Test-Path function to attempt to find the parameter file. If it returns true it gets the parameter file path, else it returns null.

I added a few lines to debug the code and I can see that it's not correctly getting path of the deployment, see the highlighted yellow sections in the image below:
image

The issue must be with the line: `$parameterFilePrefix = $path.TrimEnd(".json")

By changing the logic to use the split function (first thing i could think of doing, there might be a better way) and taking the first part it fixes the issue: $parameterFilePrefix = $path.Split('.')[0]

This fix is dependent on there not being any periods (full stops) in your file names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions