Skip to content

Commit 7d113a9

Browse files
authored
Merge pull request #193717 from mumian/0401-public-registry
Bicep public module registry
2 parents dd87fc8 + 663bb37 commit 7d113a9

File tree

5 files changed

+69
-7
lines changed

5 files changed

+69
-7
lines changed

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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: 01/03/2022
5+
ms.date: 04/08/2022
66
---
77

88
# Add module settings in the Bicep config file
@@ -99,6 +99,27 @@ For a template spec, use:
9999
module stgModule 'ts/CoreSpecs:storage:v1' = {
100100
```
101101

102+
An alias has been predefined for the [public module registry](./modules.md#path-to-module). To reference a public module, you can use the format:
103+
104+
```bicep
105+
br/public:<file>:<tag>
106+
```
107+
108+
You can override the public module registry alias definition in the bicepconfig.json file:
109+
110+
```json
111+
{
112+
"moduleAliases": {
113+
"br": {
114+
"public": {
115+
"registry": "<your_module_registry>",
116+
"modulePath": "<optional_module_path>"
117+
}
118+
}
119+
}
120+
}
121+
```
122+
102123
## Credentials for publishing/restoring modules
103124

104125
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).
56.6 KB
Loading

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

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
title: Bicep modules
33
description: Describes how to define a module in a Bicep file, and how to use module scopes.
44
ms.topic: conceptual
5-
ms.date: 02/01/2022
5+
ms.date: 04/08/2022
66
---
77

88
# Bicep modules
99

1010
Bicep enables you to organize deployments into modules. A module is just a Bicep file that is deployed from another Bicep file. With modules, you improve the readability of your Bicep files by encapsulating complex details of your deployment. You can also easily reuse modules for different deployments.
1111

12-
To share modules with other people in your organization, create a [template spec](../templates/template-specs.md) or [private registry](private-module-registry.md). Template specs and modules in the registry are only available to users with the correct permissions.
12+
To share modules with other people in your organization, create a [template spec](../templates/template-specs.md), [public registry](https://github.com/Azure/bicep-registry-modules), or [private registry](private-module-registry.md). Template specs and modules in the registry are only available to users with the correct permissions.
1313

1414
> [!TIP]
1515
> The choice between module registry and template specs is mostly a matter of preference. There are a few things to consider when you choose between the two:
@@ -77,6 +77,41 @@ For example, to deploy a file that is up one level in the directory from your ma
7777

7878
### File in registry
7979

80+
#### Public module registry
81+
82+
The public module registry is hosted in a Microsoft container registry (MCR). The source code and the modules are stored in [GitHub](https://github.com/azure/bicep-registry-modules). The [README file](https://github.com/azure/bicep-registry-modules#readme) in the GitHub repo lists the available modules and their latest versions:
83+
84+
![Bicep public module registry modules](./media/modules/bicep-public-module-registry-modules.png)
85+
86+
Select the versions to see the available versions. You can also select **Code** to see the module source code, and open the Readme files.
87+
88+
There are only a few published modules currently. More modules are coming. If you like to contribute to the registry, see the [contribution guide](https://github.com/Azure/bicep-registry-modules/blob/main/CONTRIBUTING.md).
89+
90+
To link to a public registry module, specify the module path with the following syntax:
91+
92+
```bicep
93+
module <symbolic-name> 'br/public:<file-path>:<tag>' = {}
94+
```
95+
96+
- **br/public** is the alias for the public module registry.
97+
- **file path** can contain segments that can be separated by the `/` character.
98+
- **tag** is used for specifying a version for the module.
99+
100+
For example:
101+
102+
::: code language="bicep" source="~/azure-docs-bicep-samples/syntax-samples/modules/registry-definition-public.bicep" highlight="1" :::
103+
104+
> [!NOTE]
105+
> **br/public** is the alias for the public registry. It can also be written as
106+
>
107+
> ```bicep
108+
> module <symbolic-name> 'br:mcr.microsoft.com/bicep/<file-path>:<tag>' = {}
109+
> ```
110+
>
111+
> For more information see aliases and configuring aliases later in this section.
112+
113+
#### Private module registry
114+
80115
If you've [published a module to a registry](bicep-cli.md#publish), you can link to that module. Provide the name for the Azure container registry and a path to the module. Specify the module path with the following syntax:
81116
82117
```bicep
@@ -97,6 +132,12 @@ The full path for a module in a registry can be long. Instead of providing the f
97132

98133
::: code language="bicep" source="~/azure-docs-bicep-samples/syntax-samples/modules/alias-definition.bicep" highlight="1" :::
99134

135+
An alias for the public module registry has been predefined:
136+
137+
::: code language="bicep" source="~/azure-docs-bicep-samples/syntax-samples/modules/alias-definition-public.bicep" highlight="1" :::
138+
139+
You can override the public alias in the bicepconfig.json file.
140+
100141
### File in template spec
101142

102143
After creating a [template spec](../bicep/template-specs.md), you can link to that template spec in a module. Specify the template spec in the following format:

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
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: 02/21/2022
5+
ms.date: 04/01/2022
66
---
77

88
# Create private registry for Bicep modules
99

10-
To share [modules](modules.md) within your organization, you can create a private module registry. You publish modules to that registry and give read access to users who need to deploy the modules. After the modules are shared in the registries, you can reference them from your Bicep files.
10+
To share [modules](modules.md) within your organization, you can create a private module registry. You publish modules to that registry and give read access to users who need to deploy the modules. After the modules are shared in the registries, you can reference them from your Bicep files. To contribute to the public module registry, see the [contribution guide](https://github.com/Azure/bicep-registry-modules/blob/main/CONTRIBUTING.md).
1111

1212
To work with module registries, you must have [Bicep CLI](./install.md) version **0.4.1008 or later**. To use with Azure CLI, you must also have version **2.31.0 or later**; to use with Azure PowerShell, you must also have version **7.0.0** or later.
1313

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
title: Publish modules to private module registry
33
description: Publish Bicep modules to private module registry and use the modules.
4-
ms.date: 01/04/2022
4+
ms.date: 04/01/2022
55
ms.topic: quickstart
66
ms.custom: mode-api
77
#Customer intent: As a developer new to Azure deployment, I want to learn how to publish Bicep modules to private module registry.
88
---
99

1010
# Quickstart: Publish Bicep modules to private module registry
1111

12-
Learn how to publish Bicep modules to private modules registry, and how to call the modules from your Bicep files. Private module registry allows you to share Bicep modules within your organization. To learn more, see [Create private registry for Bicep modules](./private-module-registry.md).
12+
Learn how to publish Bicep modules to private modules registry, and how to call the modules from your Bicep files. Private module registry allows you to share Bicep modules within your organization. To learn more, see [Create private registry for Bicep modules](./private-module-registry.md). To contribute to the public module registry, see the [contribution guide](https://github.com/Azure/bicep-registry-modules/blob/main/CONTRIBUTING.md).
1313

1414
## Prerequisites
1515

0 commit comments

Comments
 (0)