MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.21k stars 21.37k forks source link

The suggested file naming convention for different environments does not work #73265

Closed theikell closed 3 years ago

theikell commented 3 years ago

I'm trying to create a process to be able to deploy the same ARM template to different environments. My template file name is:

ServiceFabricCluster.json

A parameters file name of ServiceFabricCluster.parameters.json within the same folder works as expected but a parameter file name of ServiceFabricCluster.parameters-dev.json is not recognized and I'm prompted to provide values for each of my parameters.

I also tried using the name ServiceFabricCluster.parameters.json but in a subfolder, for example /dev/ServiceFabricCluster.parameters.json, but that also does not work and I'm prompted for parameter values.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

tfitzmac commented 3 years ago

@theikell - thanks for this feedback. I double-checked using different parameter names, and they worked correctly. You would have to change the deployment command to point to the correct file name. Perhaps that is something that needs to clarified in the doc. What command did you use to deploy the template and parameter file?

theikell commented 3 years ago

I'm validating/deploying from VS. I am selecting the desired parameters file and VS is generating the command, which includes the correct file name. The command generated by VS is:

Deploy-AzureResourceGroup.ps1' -StorageAccountName '' -ResourceGroupName 'rg-rnr-dev' -ResourceGroupLocation 'centralus' -TemplateFile 'servicefabriccluster.json' -TemplateParametersFile 'servicefabriccluster.parameters-dev.json' -ArtifactStagingDirectory '.' -DSCSourceFolder '.\DSC'

A PS window is then opened and begins prompting for every parameter, the first prompt is for the adminPassword:

cmdlet Test-AzureRmResourceGroupDeployment at command pipeline position 1 Supply values for the following parameters: (Type !? for Help.) adminPassword:

My parameters file is set to get the adminPassword from Key Vault. All other parameters are in the parameters file in clear text but I'm still prompted to supply them. If my parameters file is instead named servicefabriccluster.parameters.json (note the absence of -dev) the ARM template is deployed correctly and the resources are created as expected without prompting me to supply any parameters.

On Mon, Apr 5, 2021 at 2:38 PM Tom FitzMacken @.***> wrote:

@theikell https://github.com/theikell - thanks for this feedback. I double-checked using different parameter names, and they worked correctly. You would have to change the deployment command to point to the correct file name. Perhaps that is something that needs to clarified in the doc. What command did you use to deploy the template and parameter file?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/azure-docs/issues/73265#issuecomment-813635718, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKEBPBPTBYBKTUEEOKJRDLTHINULANCNFSM42NGHYBA .

tfitzmac commented 3 years ago

@theikell - I noticed the same behavior when I tried using a different parameter file through Visual Studio. I was able to fix my deployment by changing the Build Action for the new parameter file. It was set to None by default. I switched it to Content, and then my deployment successfully picked up the other parameter file.

Let me know if that helps your scenario. If so, I can add the suggestion to the doc.

tfitzmac commented 3 years ago

I have added content about making sure the Build Action is set to Content. The update should get published later today. I'll close the issue for now, but if you think more clarification is needed, we can reopen.

please-close

theikell commented 3 years ago

Thanks for the help @tfitzmac , changing the Build Action to Content solved the issue for me.