Skip to content

Commit 7738d20

Browse files
committed
how-to-articles-about-providing-parameters
1 parent 3e6655e commit 7738d20

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

articles/azure-resource-manager/bicep/key-vault-parameter.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Use Azure Key Vault to Pass a Secret as a Parameter During Bicep Deployment
33
description: Learn how to pass a secret from a key vault as a parameter during Bicep deployment.
44
ms.topic: conceptual
5-
ms.date: 01/13/2025
5+
ms.date: 01/31/2025
66
ms.custom: devx-track-azurepowershell, devx-track-azurecli, devx-track-bicep
77
---
88

@@ -13,7 +13,7 @@ This article explains how to use Azure Key Vault to pass a secret as a parameter
1313
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.
1414

1515
> [!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.
1717
1818
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).
1919

@@ -102,9 +102,9 @@ For more information about creating key vaults and adding secrets, see:
102102

103103
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.
104104

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:
106106

107-
1. Create a custom JSON file by using a role definition:
107+
1. Create a custom JSON file with a role definition:
108108

109109
```json
110110
{
@@ -151,7 +151,7 @@ The following procedure demonstrates how to create a role with the minimum permi
151151

152152
The preceding examples assign the custom role to the user on the resource-group level.
153153

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).
155155

156156
## Retrieve secrets in a Bicep file
157157

@@ -209,9 +209,9 @@ module sql './sql.bicep' = {
209209

210210
## Retrieve secrets in a parameters file
211211

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.
213213

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:
215215

216216
```bicep
217217
param sqlServerName string
@@ -248,7 +248,7 @@ param adminPassword = az.getSecret('<subscription-id>', '<rg-name>', '<key-vault
248248

249249
### JSON parameters file
250250

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 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.
252252

253253
```json
254254
{
@@ -273,7 +273,7 @@ In a JSON parameters file, specify a parameter that matches the name of the para
273273
}
274274
```
275275

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:
277277

278278
```json
279279
"secretName": "ExamplePassword",

articles/azure-resource-manager/bicep/parameter-files.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This article shows you how to create a parameters file, which you can use instea
1313
> [!NOTE]
1414
> 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.
1515
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.
1717

1818
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).
1919

@@ -30,7 +30,7 @@ param <first-parameter-name> = <first-value>
3030
param <second-parameter-name> = <second-value>
3131
```
3232

33-
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:
3434

3535
```bicep
3636
using './main.bicep'
@@ -59,7 +59,7 @@ using 'ts:00000000-0000-0000-0000-000000000000/myResourceGroup/storageSpec:1.0'
5959

6060
For more information, see [Using statement](./bicep-using.md).
6161

62-
You can use expressions with the default value. See the following example:
62+
You can use expressions with the default value. For example:
6363

6464
```bicep
6565
using 'main.bicep'
@@ -68,7 +68,7 @@ param storageName = toLower('MyStorageAccount')
6868
param intValue = 2 + 2
6969
```
7070

71-
You can reference environment variables as parameter values. See the following example:
71+
You can reference environment variables as parameter values. For example:
7272

7373
```bicep
7474
using './main.bicep'
@@ -125,7 +125,7 @@ param environmentSettings = {
125125
---
126126

127127
> [!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.
129129
130130
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).
131131

@@ -193,13 +193,13 @@ Use Bicep syntax to declare [objects](./data-types.md#objects) and [arrays](./da
193193

194194
The file extension for a Bicep parameters file is `.bicepparam`.
195195

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.
197197

198198
### [JSON parameters file](#tab/JSON)
199199

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.
201201

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.
203203

204204
---
205205

@@ -233,7 +233,7 @@ param storageAccountType
233233

234234
The `using` statement ties the Bicep parameters file to a Bicep file. For more information, see [Using statement](./bicep-using.md).
235235

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.
237237

238238
:::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.":::
239239

@@ -350,13 +350,13 @@ param storageAccountType = 'Standard_ZRS'
350350
```
351351

352352
> [!NOTE]
353-
> 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.
354354
355355
---
356356

357357
## Generate parameters file
358358

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.
360360

361361
## Build Bicep parameters file
362362

@@ -366,7 +366,7 @@ From the Bicep CLI, you can build a Bicep parameters file into a JSON parameters
366366

367367
### Azure CLI
368368

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.
370370

371371
### [Bicep parameters file](#tab/Bicep)
372372

@@ -390,7 +390,7 @@ az deployment group create \
390390

391391
---
392392

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:
394394

395395
### [Bicep parameters file](#tab/Bicep)
396396

@@ -443,7 +443,7 @@ New-AzResourceGroupDeployment `
443443

444444
---
445445

446-
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:
447447

448448
### [Bicep parameters file](#tab/Bicep)
449449

@@ -473,13 +473,13 @@ For more information, see [Deploy Bicep files by using Azure PowerShell](./deplo
473473

474474
## Parameter precedence
475475

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.
477477

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.
479479

480480
## Parameter name conflicts
481481

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.
483483

484484
## Related content
485485

0 commit comments

Comments
 (0)