Skip to content

Commit 08c0a85

Browse files
Merge pull request #295981 from LiSeda/LS-batch8
LS_Bicep_batch 8
2 parents 7faa940 + da0c93d commit 08c0a85

File tree

5 files changed

+50
-51
lines changed

5 files changed

+50
-51
lines changed

articles/azure-resource-manager/bicep/conditional-resource-deployment.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Conditional deployment with Bicep
3-
description: Describes how to conditionally deploy a resource in Bicep.
2+
title: Conditional deployments in Bicep with the if expression
3+
description: Understand how to use the 'if' expression to conditionally deploy a resource in Bicep.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 07/11/2024
6+
ms.date: 03/25/2025
77
---
88

99
# Conditional deployments in Bicep with the if expression
@@ -19,7 +19,7 @@ If you would rather learn about conditions through step-by-step guidance, see [B
1919

2020
## Define condition for deployment
2121

22-
In Bicep, you can conditionally deploy a resource by passing in a parameter that specifies whether the resource is deployed. You test the condition with an `if` expression in the resource declaration. The following example shows the syntax for an `if` expression in a Bicep file. It conditionally deploys a DNS zone. When `deployZone` is `true`, it deploys the DNS zone. When `deployZone` is `false`, it skips deploying the DNS zone.
22+
In Bicep, you can conditionally deploy a resource by passing in a parameter that specifies if the resource is deployed. You test the condition with an `if` expression in the resource declaration. The following example shows the syntax for an `if` expression in a Bicep file. It conditionally deploys a Domain Name System (DNS) zone. When `deployZone` is `true`, it deploys the DNS zone. When `deployZone` is `false`, it skips deploying the DNS zone.
2323

2424
```bicep
2525
param deployZone bool
@@ -30,7 +30,7 @@ resource dnsZone 'Microsoft.Network/dnsZones@2023-07-01-preview' = if (deployZon
3030
}
3131
```
3232

33-
The next example conditionally deploys a module.
33+
The following example conditionally deploys a module:
3434

3535
```bicep
3636
param deployZone bool
@@ -40,11 +40,11 @@ module dnsZone 'dnszones.bicep' = if (deployZone) {
4040
}
4141
```
4242

43-
Conditions may be used with dependency declarations. For [explicit dependencies](resource-dependencies.md), Azure Resource Manager automatically removes it from the required dependencies when the resource isn't deployed. For implicit dependencies, referencing a property of a conditional resource is allowed but may produce a deployment error.
43+
Conditions can be used with dependency declarations. For [explicit dependencies](resource-dependencies.md), Azure Resource Manager automatically removes them from the required dependencies when the resource isn't deployed. For implicit dependencies, referencing a property of a conditional resource is allowed but might produce a deployment error.
4444

4545
## New or existing resource
4646

47-
You can use conditional deployment to create a new resource or use an existing one. The following example shows how to either deploy a new storage account or use an existing storage account.
47+
You can use conditional deployment to create a new resource or use an existing one. The following example shows how to deploy a new storage account or use an existing storage account.
4848

4949
```bicep
5050
param storageAccountName string
@@ -72,16 +72,16 @@ resource saExisting 'Microsoft.Storage/storageAccounts@2023-04-01' existing = if
7272
output storageAccountId string = ((newOrExisting == 'new') ? saNew.id : saExisting.id)
7373
```
7474

75-
When the parameter `newOrExisting` is set to **new**, the condition evaluates to true. The storage account is deployed. Otherwise the existing storage account is used.
75+
When the parameter `newOrExisting` is set to **new**, the condition evaluates to true. The storage account is deployed. Otherwise, the existing storage account is used.
7676

7777
> [!WARNING]
78-
> If you reference a conditionally-deployed resource that is not deployed. You will get an error saying the resource is not defined in the template.
78+
> If you reference a conditionally deployed resource that isn't deployed, you'll get an error saying that the resource isn't defined in the template.
7979
8080
## Runtime functions
8181

82-
If you use a [reference](./bicep-functions-resource.md#reference) or [list](./bicep-functions-resource.md#list) function with a resource that is conditionally deployed, the function is evaluated even if the resource isn't deployed. You get an error if the function refers to a resource that doesn't exist.
82+
If you use a [reference](./bicep-functions-resource.md#reference) or [list](./bicep-functions-resource.md#list) function with a resource that's conditionally deployed, the function is evaluated even if the resource isn't deployed. You get an error if the function refers to a resource that doesn't exist.
8383

84-
Use the [conditional expression ?:](./operators-logical.md#conditional-expression--) operator to make sure the function is only evaluated for conditions when the resource is deployed. The following example template shows how to use this function with expressions that are only conditionally valid.
84+
Use the [conditional expression ?:](./operators-logical.md#conditional-expression--) operator to ensure that the function is only evaluated for conditions when the resource is deployed. The following example template shows how to use this function with expressions that are only conditionally valid.
8585

8686
```bicep
8787
param vmName string
@@ -110,6 +110,5 @@ output mgmtStatus string = ((!empty(logAnalytics)) ? 'Enabled monitoring for VM!
110110

111111
## Next steps
112112

113-
* Review the Learn module [Build flexible Bicep templates by using conditions and loops](/training/modules/build-flexible-bicep-templates-conditions-loops/).
114113
* For recommendations about creating Bicep files, see [Best practices for Bicep](best-practices.md).
115114
* To create multiple instances of a resource, see [Iterative loops in Bicep](loops.md).

articles/azure-resource-manager/bicep/deploy-cli.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
title: Deploy Bicep files with the Azure CLI
33
description: Learn how to use Azure Resource Manager and the Azure CLI to deploy resources to Azure. The resources are defined in a Bicep file.
44
ms.topic: how-to
5-
ms.date: 01/13/2025
65
ms.custom: devx-track-azurecli, seo-azure-cli, devx-track-arm-template, devx-track-bicep
6+
ms.date: 03/25/2025
77
---
88

99
# Deploy Bicep files with the Azure CLI
@@ -19,7 +19,7 @@ You need a Bicep file to deploy, and the file must be local. You also need the A
1919

2020
Samples for the Azure CLI are written for the `bash` shell. To run this sample in Windows PowerShell or Command Prompt (cmd), you might need to change elements of the script.
2121

22-
If you don't have the Azure CLI installed, you can use Azure Cloud Shell. For more information, see [Deploy Bicep files with Azure Cloud Shell](./deploy-cloud-shell.md).
22+
If you don't have the Azure CLI installed, you can use Azure Cloud Shell. For more information, see [Deploy Bicep files from Azure Cloud Shell](./deploy-cloud-shell.md).
2323

2424
[!INCLUDE [permissions](../../../includes/template-deploy-permissions.md)]
2525

@@ -39,23 +39,23 @@ You can target your deployment to a resource group, subscription, management gro
3939
az deployment sub create --location <location> --template-file <path-to-bicep>
4040
```
4141

42-
For more information about subscription-level deployments, see [Use Bicep to deploy resources to subscription](deploy-to-subscription.md).
42+
For more information about subscription-level deployments, see [Subscription deployments with Bicep files](deploy-to-subscription.md).
4343

4444
* To deploy to a **management group**, use [`az deployment mg create`](/cli/azure/deployment/mg#az-deployment-mg-create):
4545

4646
```azurecli-interactive
4747
az deployment mg create --location <location> --template-file <path-to-bicep>
4848
```
4949

50-
For more information about management-group-level deployments, see [Use Bicep to deploy resources to management group](deploy-to-management-group.md).
50+
For more information about management-group-level deployments, see [Management group deployments with Bicep files](deploy-to-management-group.md).
5151

5252
* To deploy to a **tenant**, use [`az deployment tenant create`](/cli/azure/deployment/tenant#az-deployment-tenant-create):
5353

5454
```azurecli-interactive
5555
az deployment tenant create --location <location> --template-file <path-to-bicep>
5656
```
5757

58-
For more information about tenant-level deployments, see [Use Bicep to deploy resources to tenant](deploy-to-tenant.md).
58+
For more information about tenant-level deployments, see [Tenant deployments with Bicep file](deploy-to-tenant.md).
5959

6060
## Deploy local Bicep file
6161

@@ -170,7 +170,7 @@ The evaluation of parameters follows a sequential order, meaning that if a value
170170

171171
### Bicep parameters files
172172

173-
Rather than passing parameters as inline values in your script, you might find it easier to use a [Bicep parameters file](#bicep-parameters-files) or a [JSON parameters file](#json-parameters-files) that contains the parameter values. The parameters file must be a local file since the Azure CLI doesn't support external parameters files. For more information about parameters files, see [Create parameters files for Bicep deployment](./parameter-files.md).
173+
Rather than passing parameters as inline values in your script, you might find it easier to use a [Bicep parameters file](#bicep-parameters-files) or a [JSON parameters file](#json-parameters-files) that contains the parameter values. The parameters file must be a local file since the Azure CLI doesn't support external parameters files. For more information about parameters files, see [Create a parameters file for Bicep deployment](./parameter-files.md).
174174

175175
You can use a Bicep parameters file to deploy a Bicep file with [Azure CLI](./install.md#azure-cli) version 2.53.0 or later and [Bicep CLI](./install.md#visual-studio-code-and-bicep-extension) version 0.22.X or later. With the `using` statement within the Bicep parameters file, there's no need to provide the `--template-file` switch when specifying a Bicep parameters file for the `--parameters` switch. Including the `--template-file` switch will prompt an, "Only a .bicep template is allowed with a .bicepparam file," error.
176176

@@ -233,4 +233,4 @@ To avoid conflicts with concurrent deployments and to ensure unique entries in t
233233

234234
## Next steps
235235

236-
To understand how to define parameters in your file, see [Understand the structure and syntax of Bicep files](file.md).
236+
To understand how to define parameters in your file, see [Bicep file structure and syntax](file.md).

articles/azure-resource-manager/bicep/modules.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Bicep modules
33
description: This article describes how to define a module in a Bicep file and how to use module scopes.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 02/21/2025
6+
ms.date: 03/25/2025
77
---
88

99
# Bicep modules
@@ -91,7 +91,7 @@ module <symbolic-name> '<path-to-file>' = {
9191
}
9292
```
9393

94-
To *conditionally deploy a module*, add an `if` expression. The use is similar to [conditionally deploying a resource](conditional-resource-deployment.md).
94+
To *conditionally deploy a module*, add an `if` expression. This is similar to [conditionally deploying a resource](conditional-resource-deployment.md).
9595

9696
```bicep
9797
// conditional deployment
@@ -116,7 +116,7 @@ module <symbolic-name> '<path-to-file>' = [for <item> in <collection>: {
116116
}]
117117
```
118118

119-
Like resources, modules are deployed in parallel unless they depend on other modules or resources. Typically, you don't need to set dependencies because they're determined implicitly. If you need to set an explicit dependency, add `dependsOn` to the module definition. To learn more about dependencies, see [Resource dependencies](resource-dependencies.md).
119+
Like resources, modules are deployed in parallel unless they depend on other modules or resources. Typically, you don't need to set dependencies because they're determined implicitly. If you need to set an explicit dependency, add `dependsOn` to the module definition. To learn more about dependencies, see [Resource dependencies in Bicep](resource-dependencies.md).
120120

121121
```bicep
122122
module <symbolic-name> '<path-to-file>' = {
@@ -136,7 +136,7 @@ The file for the module can be either a local file or an external file. The exte
136136

137137
### Local file
138138

139-
If the module is a *local file*, provide a relative path to that file. All paths in Bicep must be specified by using the forward slash (/) directory separator to ensure consistent compilation across platforms. The Windows backslash (\\) character is unsupported. Paths can contain spaces.
139+
If the module is a *local file*, provide a relative path to that file. All paths in Bicep must be specified by the forward slash (/) directory separator to ensure consistent compilation across platforms. The Windows backslash (\\) character isn't supported. Paths can contain spaces.
140140

141141
For example, to deploy a file that's up one level in the directory from your main file, use:
142142

@@ -160,7 +160,7 @@ There are public and private module registries.
160160
161161
[Azure Verified Modules](https://azure.github.io/Azure-Verified-Modules/) are prebuilt, pretested, and preverified modules that you can use to deploy resources on Azure. Microsoft employees created and own these modules. They were designed to simplify and accelerate the deployment process for common Azure resources and configurations. The modules also align to best practices like Azure Well-Architected Framework.
162162

163-
Browse to the [Azure Verified Modules Bicep Index](https://azure.github.io/Azure-Verified-Modules/indexes/bicep/) to see the list of modules that are available. Select the highlighted numbers in the following screenshot to go directly to that filtered view.
163+
Browse [Bicep Modules](https://azure.github.io/Azure-Verified-Modules/indexes/bicep/) to see the list of modules that are available. Select the highlighted numbers in the following screenshot to go directly to that filtered view:
164164

165165
:::image type="content" source="./media/modules/bicep-azure-verified-modules-avm.png" alt-text="Screenshot that shows Azure Verified Modules.":::
166166

@@ -174,9 +174,9 @@ To link to a public module, specify the module path with the following syntax:
174174
module <symbolic-name> 'br/public:<file-path>:<tag>' = {}
175175
```
176176

177-
- **br/public**: Is the alias for public modules. You can customize this alias in the [Bicep configuration file](./bicep-config-modules.md).
178-
- **file path**: Can contain segments that you can separate by the `/` character.
179-
- **tag**: Is used for specifying a version for the module.
177+
- **br/public**: This is the alias for public modules. You can customize this alias in the [Bicep configuration file](./bicep-config-modules.md).
178+
- **file path**: This can contain segments that you can separate with the `/` character.
179+
- **tag**: This is used for specifying a version for the module.
180180

181181
For example:
182182

@@ -205,8 +205,8 @@ If you [published a module to a registry](bicep-cli.md#publish), you can link to
205205
module <symbolic-name> 'br:<registry-name>.azurecr.io/<file-path>:<tag>' = {
206206
```
207207
208-
- **br**: Is a scheme name for a Bicep registry.
209-
- **file path**: Is called `repository` in Azure Container Registry. The file path can contain segments that are separated by the `/` character.
208+
- **br**: This is a scheme name for a Bicep registry.
209+
- **file path**: This is called `repository` in Azure Container Registry. The file path can contain segments that are separated by the `/` character.
210210
- **tag**: Is used to specify a version for the module.
211211

212212
For example:
@@ -220,7 +220,7 @@ module stgModule 'br:exampleregistry.azurecr.io/bicep/modules/storage:v1' = {
220220
}
221221
```
222222

223-
When you reference a module in a registry, the Bicep extension in Visual Studio Code automatically calls [bicep restore](bicep-cli.md#restore) to copy the external module to the local cache. It takes a few moments to restore the external module. If IntelliSense for the module doesn't work immediately, wait for the restore to complete.
223+
When you reference a module in a registry, the Bicep extension in Visual Studio Code automatically calls [`bicep restore`](bicep-cli.md#restore) to copy the external module to the local cache. It takes a few moments to restore the external module. If IntelliSense for the module doesn't work immediately, wait for the restore to complete.
224224

225225
The full path for a module in a registry can be long. Instead of providing the full path each time you want to use the module, [configure aliases in the bicepconfig.json file](bicep-config-modules.md#aliases-for-modules). The aliases make it easier to reference the module. For example, with an alias, you can shorten the path to:
226226

@@ -273,7 +273,7 @@ module stgModule 'ts/ContosoSpecs:storageSpec:2.0' = {
273273

274274
## Use decorators
275275

276-
Decorators are written in the format `@expression` and are placed above module declarations. The following table shows the available decorators for modules.
276+
Decorators are written in the format `@expression` and are placed above module declarations. The following table shows the available decorators for modules:
277277

278278
| Decorator | Argument | Description |
279279
| --------- | ----------- | ------- |
@@ -450,7 +450,7 @@ module storage2 '../create-storage-account/main.bicep' = {
450450
}
451451
```
452452

453-
Set the `scope` property to a valid scope object. If your Bicep file deploys a resource group, subscription, or management group, you can set the scope for a module to the symbolic name for that resource. Or you can use the scope functions to get a valid scope.
453+
Set the `scope` property to a valid scope object. If your Bicep file deploys a resource group, subscription, or management group, you can set the scope for a module to the symbolic name for that resource. Or, you can use the scope functions to get a valid scope.
454454

455455
Those functions are:
456456

@@ -474,7 +474,7 @@ module mgDeploy 'main.bicep' = {
474474

475475
You can get values from a module and use them in the main Bicep file. To get an output value from a module, use the `outputs` property on the module object.
476476

477-
The first example creates a storage account and returns the primary endpoints.
477+
The first example creates a storage account and returns the primary endpoints:
478478

479479
```bicep
480480
@minLength(3)
@@ -512,7 +512,7 @@ resource stg 'Microsoft.Storage/storageAccounts@2023-04-01' = {
512512
output storageEndpoint object = stg.properties.primaryEndpoints
513513
```
514514

515-
When the property is used as a module, you can get that output value.
515+
When the property is used as a module, you can get that output value:
516516

517517
```bicep
518518
targetScope = 'subscription'
@@ -539,5 +539,5 @@ output storageEndpoint object = stgModule.outputs.storageEndpoint
539539

540540
## Related content
541541

542-
- For a tutorial, see [Deploy Azure resources by using Bicep templates](/training/modules/deploy-azure-resources-by-using-bicep-templates/).
543-
- To pass a sensitive value to a module, use the [getSecret](bicep-functions-resource.md#getsecret) function.
542+
- For a tutorial, see [Build your first Bicep template](/training/modules/deploy-azure-resources-by-using-bicep-templates/).
543+
- To pass a sensitive value to a module, use the [`getSecret`](bicep-functions-resource.md#getsecret) function.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Create Parameters Files for Bicep Deployment
3-
description: Learn how to create Bicep parameters files, instead of passing parameters as inline values in your script.
2+
title: Create a parameters file for bicep deployment
3+
description: Learn how to create Bicep parameters files instead of passing parameters as inline values in your script.
44
ms.topic: how-to
5-
ms.date: 01/10/2025
65
ms.custom: devx-track-bicep
6+
ms.date: 03/25/2025
77
---
88

99
# Create a parameters file for Bicep deployment
@@ -473,7 +473,7 @@ New-AzResourceGroupDeployment `
473473

474474
---
475475

476-
For more information, see [Deploy Bicep files by using Azure PowerShell](./deploy-powershell.md#parameters). To deploy `.bicep` files, you need Azure PowerShell version 5.6.0 or later.
476+
For more information, see [Deploy Bicep files with Azure PowerShell](./deploy-powershell.md#parameters). To deploy `.bicep` files, you need Azure PowerShell version 5.6.0 or later.
477477

478478
## Parameter precedence
479479

0 commit comments

Comments
 (0)