ARM templates allow you to define parameters that can be passed to your Logic App during deployment. These parameters can be environment-specific.
{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "logicAppName": { "type": "string", "defaultValue": "MyLogicApp" }, "environmentSetting": { "type": "string", "allowedValues": ["dev", "staging", "prod"], "defaultValue": "dev" }, "apiUrl": { "type": "string" } }, "resources": [ { "type": "Microsoft.Logic/workflows", "apiVersion": "2017-07-01", "name": "[parameters('logicAppName')]", "location": "[resourceGroup().location]", "properties": { "definition": { "$schema": "https://schema.management.azure.com/schemas/2016-06-01/Microsoft.Logic.json", "contentVersion": "1.0.0.0", "parameters": { "apiUrl": { "type": "string", "defaultValue": "[parameters('apiUrl')]" } }, "triggers": {}, "actions": {}, "outputs": {} }, "parameters": { "apiUrl": { "value": "[parameters('apiUrl')]" } } } } ] }
environmentSetting
is a parameter to specify the environment (e.g., dev, staging, prod).apiUrl
is a parameter that can be passed to the Logic App.Azure Key Vault is a secure way to store and retrieve sensitive parameters (e.g., connection strings, API keys).
apiUrl
as a secret for each environment (e.g., dev-apiUrl
, staging-apiUrl
, prod-apiUrl
).Get Secret
action to retrieve the apiUrl
for the current environment.dev-parameters.json
, staging-parameters.json
, prod-parameters.json
).dev-parameters.json
:{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "parameters": { "environmentSetting": { "value": "dev" }, "apiUrl": { "value": "https://dev-api.example.com" } } }
az deployment group create \ --resource-group <ResourceGroupName> \ --template-file <TemplateFile.json> \ --parameters <ParameterFile.json>
apiUrl
parameter in an HTTP action:{ "type": "Http", "inputs": { "method": "GET", "uri": "@{parameters('apiUrl')}/endpoint" } }