I have a parameters.json file that is an object that contains application settings for different environments. So, it looks something like this:
"parameters": {
"applicationSettings": {
"value": {
"CI": {
"setting1": "asdf"
},
"DEV": {
"setting1": "1234"
}
}
}
}
In the template file, I have a parameter called "applicationSettings" that is the object from the parameter file. In the template file, I also have a parameter called "deploymentEnvironment" that defines which environment the template is being deployed to. So, when I deploy a function app with applicationSettings, I need to only get those settings for the CI environment, for example.
I tried this:
[concat('parameters(''applicationSettings'').', parameters('deploymentEnvironment'))]
But a deployment error occurred:
{
"ErrorEntity": {
"ExtendedCode": "51008",
"MessageTemplate": "The parameter {0} has an invalid value.",
"Parameters": [
"properties"
],
"Code": "BadRequest",
"Message": "The parameter properties has an invalid value."
}
}
How can I reference a property of an object in a parameters.json file so I can pull specific application settings based on my deploymentEnvironment parameter?
you need to use the []
notation:
"[parameters('applicationSettings')[parameters('deploymentEnvironment')]]"
ps. you can combine those as well:
"[parameters('applicationSettings')[parameters('deploymentEnvironment')].property[xxx]]"
"[parameters('applicationSettings').property[xxx][parameters('deploymentEnvironment')]]"