Skip to content

Commit 4d0c697

Browse files
authored
Merge pull request #223459 from mumian/0109-bicepconfig-profiles
add currentProfile to the bicepConfig
2 parents 963ea32 + b4475e1 commit 4d0c697

File tree

5 files changed

+59
-42
lines changed

5 files changed

+59
-42
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Bicep CLI commands and overview
33
description: Describes the commands that you can use in the Bicep CLI. These commands include building Azure Resource Manager templates from Bicep.
44
ms.topic: conceptual
5-
ms.date: 09/14/2022
5+
ms.date: 01/10/2023
66
---
77

88
# Bicep CLI commands
@@ -130,7 +130,7 @@ The command returns an array of available versions.
130130

131131
## publish
132132

133-
The `publish` command adds a module to a registry. The Azure container registry must exist and the account publishing to the registry must have the correct permissions. For more information about setting up a module registry, see [Use private registry for Bicep modules](private-module-registry.md).
133+
The `publish` command adds a module to a registry. The Azure container registry must exist and the account publishing to the registry must have the correct permissions. For more information about setting up a module registry, see [Use private registry for Bicep modules](private-module-registry.md). To publish a module, the account must have the correct profile and permissions to access the registry. You can configure the profile and credential precedence for authenticating to the registry in the [Bicep config file](./bicep-config-modules.md#configure-profiles-and-credentials).
134134

135135
After publishing the file to the registry, you can [reference it in a module](modules.md#file-in-registry).
136136

@@ -157,7 +157,7 @@ The `publish` command doesn't recognize aliases that you've defined in a [bicepc
157157

158158
When your Bicep file uses modules that are published to a registry, the `restore` command gets copies of all the required modules from the registry. It stores those copies in a local cache. A Bicep file can only be built when the external files are available in the local cache. Typically, you don't need to run `restore` because it's called automatically by `build`.
159159

160-
To restore external modules to the local cache, the account must have the correct permissions to access the registry. You can configure the credential precedence for authenticating to the registry in the [Bicep config file](./bicep-config-modules.md#credentials-for-publishingrestoring-modules).
160+
To restore external modules to the local cache, the account must have the correct profile and permissions to access the registry. You can configure the profile and credential precedence for authenticating to the registry in the [Bicep config file](./bicep-config-modules.md#configure-profiles-and-credentials).
161161

162162
To use the restore command, you must have Bicep CLI version **0.4.1008 or later**. This command is currently only available when calling the Bicep CLI directly. It's not currently available through the Azure CLI command.
163163

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

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
title: Module setting for Bicep config
33
description: Describes how to customize configuration values for modules in Bicep deployments.
44
ms.topic: conceptual
5-
ms.date: 04/08/2022
5+
ms.date: 01/11/2023
66
---
77

88
# Add module settings in the Bicep config file
99

10-
In a **bicepconfig.json** file, you can create aliases for module paths and configure credential precedence for restoring a module.
10+
In a **bicepconfig.json** file, you can create aliases for module paths and configure profile and credential precedence for publishing and restoring modules.
1111

12-
This article describes the settings that are available for working with [modules](modules.md).
12+
This article describes the settings that are available for working with [Bicep modules](modules.md).
1313

1414
## Aliases for modules
1515

@@ -120,9 +120,54 @@ You can override the public module registry alias definition in the bicepconfig.
120120
}
121121
```
122122

123-
## Credentials for publishing/restoring modules
123+
## Configure profiles and credentials
124124

125-
To [publish](bicep-cli.md#publish) modules to a private module registry or to [restore](bicep-cli.md#restore) external modules to the local cache, the account must have the correct permissions to access the registry. You can configure the credential precedence for authenticating to the registry. By default, Bicep uses the credentials from the user authenticated in Azure CLI or Azure PowerShell. To customize the credential precedence, see [Add credential precedence to Bicep config](bicep-config.md#credential-precedence).
125+
To [publish](bicep-cli.md#publish) modules to a private module registry or to [restore](bicep-cli.md#restore) external modules to the local cache, the account must have the correct permissions to access the registry. You can configure the profile and the credential precedence for authenticating to the registry. By default, Bicep uses the `AzureCloud` profile and the credentials from the user authenticated in Azure CLI or Azure PowerShell. You can customize `currentProfile` and `credentialPrecedence` in the config file.
126+
127+
```json
128+
{
129+
"cloud": {
130+
"currentProfile": "AzureCloud",
131+
"profiles": {
132+
"AzureCloud": {
133+
"resourceManagerEndpoint": "https://management.azure.com",
134+
"activeDirectoryAuthority": "https://login.microsoftonline.com"
135+
},
136+
"AzureChinaCloud": {
137+
"resourceManagerEndpoint": "https://management.chinacloudapi.cn",
138+
"activeDirectoryAuthority": "https://login.chinacloudapi.cn"
139+
},
140+
"AzureUSGovernment": {
141+
"resourceManagerEndpoint": "https://management.usgovcloudapi.net",
142+
"activeDirectoryAuthority": "https://login.microsoftonline.us"
143+
}
144+
},
145+
"credentialPrecedence": [
146+
"AzureCLI",
147+
"AzurePowerShell"
148+
]
149+
}
150+
}
151+
```
152+
153+
The available profiles are:
154+
155+
- AzureCloud
156+
- AzureChinaCloud
157+
- AzureUSGovernment
158+
159+
You can customize these profiles, or add new profiles for your on-premises environments.
160+
161+
The available credential types are:
162+
163+
- AzureCLI
164+
- AzurePowerShell
165+
- Environment
166+
- ManagedIdentity
167+
- VisualStudio
168+
- VisualStudioCode
169+
170+
[!INCLUDE [vscode authentication](../../../includes/resource-manager-vscode-authentication.md)]
126171

127172
## Next steps
128173

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

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Bicep config file
33
description: Describes the configuration file for your Bicep deployments
44
ms.topic: conceptual
5-
ms.date: 12/06/2022
5+
ms.date: 01/09/2023
66
---
77

88
# Configure your Bicep environment
@@ -17,38 +17,10 @@ To create a `bicepconfig.json` file in Visual Studio Code, open the Command Pale
1717

1818
## Available settings
1919

20-
When working with [modules](modules.md), you can add aliases for module paths. These aliases simplify your Bicep file because you don't have to repeat complicated paths. For more information, see [Add module settings to Bicep config](bicep-config-modules.md).
20+
When working with [modules](modules.md), you can add aliases for module paths. These aliases simplify your Bicep file because you don't have to repeat complicated paths. You can also configure cloud profile and credential precedence for authenticating to Azure from Bicep CLI and Visual Studio Code. The credentials are used to publish modules to registries and to restore external modules to the local cache when using the insert resource function.For more information, see [Add module settings to Bicep config](bicep-config-modules.md).
2121

2222
The [Bicep linter](linter.md) checks Bicep files for syntax errors and best practice violations. You can override the default settings for the Bicep file validation by modifying `bicepconfig.json`. For more information, see [Add linter settings to Bicep config](bicep-config-linter.md).
2323

24-
You can also configure the credential precedence for authenticating to Azure from Bicep CLI and Visual Studio Code. The credentials are used to publish modules to registries and to restore external modules to the local cache when using the insert resource function.
25-
26-
## Credential precedence
27-
28-
You can configure the credential precedence for authenticating to the registry. By default, Bicep uses the credentials from the user authenticated in Azure CLI or Azure PowerShell. To customize the credential precedence, add `cloud` and `credentialPrecedence` elements to the config file.
29-
30-
```json
31-
{
32-
"cloud": {
33-
"credentialPrecedence": [
34-
"AzureCLI",
35-
"AzurePowerShell"
36-
]
37-
}
38-
}
39-
```
40-
41-
The available credential types are:
42-
43-
- AzureCLI
44-
- AzurePowerShell
45-
- Environment
46-
- ManagedIdentity
47-
- VisualStudio
48-
- VisualStudioCode
49-
50-
[!INCLUDE [vscode authentication](../../../includes/resource-manager-vscode-authentication.md)]
51-
5224
## Intellisense
5325

5426
The Bicep extension for Visual Studio Code supports intellisense for your `bicepconfig.json` file. Use the intellisense to discover available properties and values.

articles/azure-resource-manager/bicep/private-module-registry.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Create private registry for Bicep module
33
description: Learn how to set up an Azure container registry for private Bicep modules
44
ms.topic: conceptual
5-
ms.date: 04/01/2022
5+
ms.date: 01/10/2023
66
---
77

88
# Create private registry for Bicep modules
@@ -45,7 +45,7 @@ A Bicep registry is hosted on [Azure Container Registry (ACR)](../../container-r
4545
4646
1. To publish modules to a registry, you must have permission to **push** an image. To deploy a module from a registry, you must have permission to **pull** the image. For more information about the roles that grant adequate access, see [Azure Container Registry roles and permissions](../../container-registry/container-registry-roles.md).
4747
48-
1. Depending on the type of account you use to deploy the module, you may need to customize which credentials are used. These credentials are needed to get the modules from the registry. By default, credentials are obtained from Azure CLI or Azure PowerShell. You can customize the precedence for getting the credentials in the **bicepconfig.json** file. For more information, see [Credentials for restoring modules](bicep-config-modules.md#credentials-for-publishingrestoring-modules).
48+
1. Depending on the type of account you use to deploy the module, you may need to customize which credentials are used. These credentials are needed to get the modules from the registry. By default, credentials are obtained from Azure CLI or Azure PowerShell. You can customize the precedence for getting the credentials in the **bicepconfig.json** file. For more information, see [Credentials for restoring modules](bicep-config-modules.md#configure-profiles-and-credentials).
4949
5050
> [!IMPORTANT]
5151
> The private container registry is only available to users with the required access. However, it's accessed through the public internet. For more security, you can require access through a private endpoint. See [Connect privately to an Azure container registry using Azure Private Link](../../container-registry/container-registry-private-link.md).

includes/resource-manager-vscode-authentication.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
author: mumian
33
ms.service: azure-resource-manager
44
ms.topic: include
5-
ms.date: 12/06/2022
5+
ms.date: 01/10/2023
66
ms.author: jgao
77
---
88

99
> [!NOTE]
10-
> The Bicep deploy command from within vscode uses the [Azure Account extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) for authentication. It doesn't use cloud profiles from [bicepconfig.json](../articles/azure-resource-manager/bicep/bicep-config.md#credential-precedence).
10+
> The Bicep deploy command from within vscode uses the [Azure Account extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) for authentication. It doesn't use cloud profiles from [bicepconfig.json](../articles/azure-resource-manager/bicep/bicep-config-modules.md#configure-profiles-and-credentials).

0 commit comments

Comments
 (0)