You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -13,7 +13,7 @@ This article explains how to use Azure Key Vault to pass a secret as a parameter
13
13
When a [module](./modules.md) expects a string parameter with a `secure:true` modifier applied, you can use the [`getSecret` function](bicep-functions-resource.md#getsecret) to obtain a key vault secret. You don't expose the value because you reference only its key vault ID.
14
14
15
15
> [!IMPORTANT]
16
-
> This article focuses on how to pass a sensitive value as a template parameter. When the secret is passed as a parameter, the key vault can be in a different subscription than the resource group you're deploying it to.
16
+
> This article focuses on how to pass a sensitive value as a template parameter. When the secret is passed as a parameter, the key vault can exist in a different subscription than the resource group to which you're deploying.
17
17
18
18
This article doesn't cover how to set a virtual machine (VM) property to a certificate's URL in a key vault. For a quickstart template of that scenario, see [WinRM on a Windows VM](https://github.com/Azure/azure-quickstart-templates/tree/master/demos/vm-winrm-keyvault-windows).
19
19
@@ -102,9 +102,9 @@ For more information about creating key vaults and adding secrets, see:
102
102
103
103
The user who deploys the Bicep file must have the `Microsoft.KeyVault/vaults/deploy/action` permission for the scope of the resource group and key vault. The [Owner](../../role-based-access-control/built-in-roles.md#owner) and [Contributor](../../role-based-access-control/built-in-roles.md#contributor) roles both grant this access. If you created the key vault, you're the owner and have the permission.
104
104
105
-
The following procedure demonstrates how to create a role with the minimum permission and how to assign the user:
105
+
The following procedure shows how to create a role with the minimum permission and how to assign the user:
106
106
107
-
1. Create a custom JSON file by using a role definition:
107
+
1. Create a custom JSON file with a role definition:
108
108
109
109
```json
110
110
{
@@ -151,7 +151,7 @@ The following procedure demonstrates how to create a role with the minimum permi
151
151
152
152
The preceding examples assign the custom role to the user on the resource-group level.
153
153
154
-
If you use a key vault with a Bicep file for a [managed application](../managed-applications/overview.md), you must grant access to the **Appliance Resource Provider** service principal. For more information, see [Access Key Vault secret when deploying Azure managed applications](../managed-applications/key-vault-access.md).
154
+
If you use a key vault with a Bicep file for a [managed application](../managed-applications/overview.md), you must grant access to the **Appliance Resource Provider** service principal. For more information, see [Access a Key Vault secret when deploying Azure managed applications](../managed-applications/key-vault-access.md).
155
155
156
156
## Retrieve secrets in a Bicep file
157
157
@@ -209,9 +209,9 @@ module sql './sql.bicep' = {
209
209
210
210
## Retrieve secrets in a parameters file
211
211
212
-
If you don't want to use a module, you can retrieve key vault secrets in a parameters file. However, the approach is different depending on whether you use a JSON or Bicep parameters file.
212
+
If you don't want to use a module, you can retrieve key vault secrets in a parameters file. However, the approach varies depending on whether you use a JSON or Bicep parameters file.
213
213
214
-
The following Bicep file deploys an SQL server that includes an administrator password. While the password parameter is set to a secure string, Bicep doesn't specify the origin of that value:
214
+
The following Bicep file deploys a SQL server that includes an administrator password. While the password parameter is set to a secure string, Bicep doesn't specify the origin of that value:
In a JSON parameters file, specify a parameter that matches the name of the parameter in the Bicep file. For the parameter value, reference the secret from the key vault. Pass the resource identifier of the key vault and the name of the secret. In the following parameters file, the key vault secret must already exist. You need to provide a static value for its resource ID:
251
+
In a JSON parameters file, specify a parameter that matches the name of the parameter in the Bicep file. For the parameter value, reference the secret from the key vault. Pass the resource identifier of the key vault and the name of the secret. In the following parameters file, the key vault secret must already exist. You provide a static value for its resource ID.
252
252
253
253
```json
254
254
{
@@ -273,7 +273,7 @@ In a JSON parameters file, specify a parameter that matches the name of the para
273
273
}
274
274
```
275
275
276
-
If you need to use a version of the secret other than the current one, include the property `secretVersion`:
276
+
If you need to use a version of the secret other than the current one, include a `secretVersion` property:
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/parameter-files.md
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ This article shows you how to create a parameters file, which you can use instea
13
13
> [!NOTE]
14
14
> Bicep parameters files are supported only in [Bicep CLI](./install.md#visual-studio-code-and-bicep-extension) version 0.18.4 or later, [Azure CLI](/cli/azure/install-azure-cli) version 2.47.0 or later, and [Azure PowerShell](/powershell/azure/install-azure-powershell) version 9.7.1 or later.
15
15
16
-
A single Bicep file can have multiple Bicep parameters files associated with it. However, each Bicep parameters file is associated with only one particular Bicep file. You can establish this relationship by applying the [`using` statement](./bicep-using.md) within the Bicep parameters file.
16
+
A single Bicep file can have multiple Bicep parameters files associated with it. However, each Bicep parameters file is intended for one particular Bicep file. You can establish this relationship by applying the [`using` statement](./bicep-using.md) within the Bicep parameters file.
17
17
18
18
You can compile Bicep parameters files into JSON parameters files that you can deploy by using a Bicep file. For more information, see [`build-params`](./bicep-cli.md#build-params). You can also decompile a JSON parameters file into a Bicep parameters file. For more information, see [`decompile-params`](./bicep-cli.md#decompile-params).
You can apply the `using` statement by using a Bicep file, JSON Azure Resource Manager templates, Bicep modules, and template specs. See the following example:
33
+
You can apply the `using` statement by using a Bicep file, JSON Azure Resource Manager templates, Bicep modules, and template specifications. For example:
34
34
35
35
```bicep
36
36
using './main.bicep'
@@ -59,7 +59,7 @@ using 'ts:00000000-0000-0000-0000-000000000000/myResourceGroup/storageSpec:1.0'
59
59
60
60
For more information, see [Using statement](./bicep-using.md).
61
61
62
-
You can use expressions with the default value. See the following example:
62
+
You can use expressions with the default value. For example:
You can reference environment variables as parameter values. See the following example:
71
+
You can reference environment variables as parameter values. For example:
72
72
73
73
```bicep
74
74
using './main.bicep'
@@ -125,7 +125,7 @@ param environmentSettings = {
125
125
---
126
126
127
127
> [!NOTE]
128
-
>A parameters file saves parameter values as plain text. For security reasons, we don't recommend using this approach with sensitive values such as passwords.
128
+
>A parameters file saves parameter values as plain text. For security reasons, we don't recommend using this approach with sensitive values such as passwords.
129
129
130
130
If you need to pass a parameter with a sensitive value, you should keep the value in a key vault. Instead of adding a sensitive value to your parameters file, use the [`getSecret` function](bicep-functions-resource.md#getsecret) to retrieve it. For more information, see [Use Azure Key Vault to pass a secret as a parameter during Bicep deployment](key-vault-parameter.md).
131
131
@@ -193,13 +193,13 @@ Use Bicep syntax to declare [objects](./data-types.md#objects) and [arrays](./da
193
193
194
194
The file extension for a Bicep parameters file is `.bicepparam`.
195
195
196
-
In order to deploy to multiple environments, you need to create more than one parameters file. When you use multiple parameters files, label them according to their use. For example, to deploy resources, use the label _main.dev.bicepparam_ for development and the label _main.prod.bicepparam_ for production.
196
+
To deploy to multiple environments, you create more than one parameters file. When you use multiple parameters files, label them according to their use. For example, to deploy resources, use the label _main.dev.bicepparam_ for development and the label _main.prod.bicepparam_ for production.
197
197
198
198
### [JSON parameters file](#tab/JSON)
199
199
200
-
According to the general naming convention for a parameters file, you should include _parameters_ in the Bicep file name. For example, if your Bicep file is named _azuredeploy.bicep_, then your parameters file is named _azuredeploy.parameters.json_. This naming convention helps you see the connection between the Bicep file and the parameters.
200
+
The general naming convention for a parameters file is to include _parameters_ in the Bicep file name. For example, if your Bicep file is named _azuredeploy.bicep_, then your parameters file is named _azuredeploy.parameters.json_. This naming convention helps you see the connection between the Bicep file and the parameters.
201
201
202
-
In order to deploy to different environments, you need to create more than one parameters file. When you use multiple parameters files, label them according to their use. For example, to deploy resources, use the label _azuredeploy.parameters-dev.json_ for development and the label _azuredeploy.parameters-prod.json_ for production.
202
+
To deploy to different environments, you create more than one parameters file. When you use multiple parameters files, label them according to their use. For example, to deploy resources, use the label _azuredeploy.parameters-dev.json_ for development and the label _azuredeploy.parameters-prod.json_ for production.
203
203
204
204
---
205
205
@@ -233,7 +233,7 @@ param storageAccountType
233
233
234
234
The `using` statement ties the Bicep parameters file to a Bicep file. For more information, see [Using statement](./bicep-using.md).
235
235
236
-
When you type the keyword `param` in Visual Studio Code, a prompt gives you the available parameters and their descriptions from the linked Bicep file.
236
+
When you type the keyword `param` in Visual Studio Code, it prompts you the available parameters and their descriptions from the linked Bicep file.
237
237
238
238
:::image type="content" source="./media/parameter-files/bicep-parameters-file-visual-studio-code-prompt.png" alt-text="Screenshot of the prompt of the available parameters.":::
> Your parameters file can contain only values for parameters that are defined in the Bicep file. You get an error if your parameters file contains extra parameters that don't match the Bicep file's parameters.
353
+
> Your parameters file can contain only values for parameters that are defined in the Bicep file. If your parameters file contains extra parameters that don't match the Bicep file's parameters, you receive an error.
354
354
355
355
---
356
356
357
357
## Generate parameters file
358
358
359
-
You can create a parameters file two ways: by using either Visual Studio Code or the Bicep CLI. Both tools allow you to use a Bicep file to generate a parameters file. See [Generate parameters file](./visual-studio-code.md#generate-parameters-file-command) for the Visual Studio Code method and [Generate parameters file](./bicep-cli.md#generate-params) for the Bicep CLI method.
359
+
You can create a parameters file by using either Visual Studio Code or the Bicep CLI. Both tools allow you to use a Bicep file to generate a parameters file. See [Generate parameters file](./visual-studio-code.md#generate-parameters-file-command) for the Visual Studio Code method and [Generate parameters file](./bicep-cli.md#generate-params) for the Bicep CLI method.
360
360
361
361
## Build Bicep parameters file
362
362
@@ -366,7 +366,7 @@ From the Bicep CLI, you can build a Bicep parameters file into a JSON parameters
366
366
367
367
### Azure CLI
368
368
369
-
You can pass a parameters file from the Azure CLI with your Bicep file deployment.
369
+
From the Azure CLI, you can pass a parameters file with your Bicep file deployment.
370
370
371
371
### [Bicep parameters file](#tab/Bicep)
372
372
@@ -390,7 +390,7 @@ az deployment group create \
390
390
391
391
---
392
392
393
-
You can use inline parameters and a location parameters file in the same deployment operation. See the following example:
393
+
You can use inline parameters and a location parameters file in the same deployment operation. For example:
You can use inline parameters and a location parameters file in the same deployment operation. See the following example:
446
+
You can use inline parameters and a location parameters file in the same deployment operation. For example:
447
447
448
448
### [Bicep parameters file](#tab/Bicep)
449
449
@@ -473,13 +473,13 @@ For more information, see [Deploy Bicep files by using Azure PowerShell](./deplo
473
473
474
474
## Parameter precedence
475
475
476
-
You can use inline parameters and a local parameters file in the same deployment operation. For example, you can specify certain values in the local parameters file and add other values inline during deployment. If you provide values for a parameter in both the local parameters file and inline, the inline value takes precedence.
476
+
You can use inline parameters and a local parameters file in the same deployment operation. For example, you can specify some values in the local parameters file and add other values inline during deployment. If you provide values for a parameter in both the local parameters file and inline, the inline value takes precedence.
477
477
478
-
While external Bicep parameters files aren't currently supported, you can use an external JSON parameters file when you provide the URI to the file. When you use an external parameters file, you need to provide all parameter values in the external file. When you use an external file, you can't pass other values inline or from a local file, and all inline parameters are ignored.
478
+
Although external Bicep parameters files aren't currently supported, you can use an external JSON parameters file by providing the URI to the file. When you use an external parameters file, provide all parameter values in the external file. When you use an external file, you can't pass other values inline or from a local file, and all inline parameters are ignored.
479
479
480
480
## Parameter name conflicts
481
481
482
-
If your Bicep file includes a parameter with the same name as one of the parameters in the Azure PowerShell command, Azure PowerShell presents the parameter from your Bicep file with the `FromTemplate` postfix. For example, if a parameter named `ResourceGroupName` in your Bicep file conflicts with the `ResourceGroupName` parameter in the [`New-AzResourceGroupDeployment` cmdlet](/powershell/module/az.resources/new-azresourcegroupdeployment), you'll be prompted to provide a value for `ResourceGroupNameFromTemplate`. You can avoid this confusion by using parameter names that aren't used for deployment commands.
482
+
If your Bicep file includes a parameter with the same name as one of the parameters in the Azure PowerShell command, Azure PowerShell presents the parameter from your Bicep file with the `FromTemplate` postfix. For example, if a parameter named `ResourceGroupName` in your Bicep file conflicts with the `ResourceGroupName` parameter in the [`New-AzResourceGroupDeployment` cmdlet](/powershell/module/az.resources/new-azresourcegroupdeployment), you're prompted to provide a value for `ResourceGroupNameFromTemplate`. To avoid this confusion, use parameter names that aren't used for deployment commands.
0 commit comments