Skip to content
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

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

Open
stripesoc opened this issue Oct 30, 2024 · 0 comments

Comments

@stripesoc
Copy link

stripesoc commented Oct 30, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant