Skip to content

Commit 9957c03

Browse files
authored
Merge pull request #274383 from mumian/0430-vscode-withsource
Private registry publish with source
2 parents 565e893 + e08368c commit 9957c03

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed
13.7 KB
Loading

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ 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
55
ms.custom: devx-track-bicep
6-
ms.date: 04/18/2023
6+
ms.date: 05/10/2024
77
---
88

99
# Create private registry for Bicep modules
@@ -73,14 +73,38 @@ az bicep publish --file storage.bicep --target br:exampleregistry.azurecr.io/bic
7373

7474
---
7575

76+
With Bicep CLI version 0.27.1 or newer, you can publish a module with the Bicep source code in addition to the compiled JSON template. If a module is published with the Bicep source code to a registry, you can press `F12` ([Go to Definition](./visual-studio-code.md#go-to-definition)) from Visual Studio Code to see the Bicep Code. The Bicep extension version 0.27 or new is required to see the Bicep file.
77+
78+
# [PowerShell](#tab/azure-powershell)
79+
80+
```azurepowershell
81+
Publish-AzBicepModule -FilePath ./storage.bicep -Target br:exampleregistry.azurecr.io/bicep/modules/storage:v1 -DocumentationUri https://www.contoso.com/exampleregistry.html -WithSource
82+
```
83+
84+
# [Azure CLI](#tab/azure-cli)
85+
86+
To run this deployment command, you must have the [latest version](/cli/azure/install-azure-cli) of Azure CLI.
87+
88+
```azurecli
89+
az bicep publish --file storage.bicep --target br:exampleregistry.azurecr.io/bicep/modules/storage:v1 --documentationUri https://www.contoso.com/exampleregistry.html --with-source
90+
```
91+
92+
---
93+
94+
With the with source switch, you see an additional layer in the manifest:
95+
96+
:::image type="content" source="./media/private-module-registry/bicep-module-with-source-manifest.png" lightbox="./media/private-module-registry/bicep-module-with-source-manifest.png" alt-text="Screenshot of bicep module registry with source.":::
97+
98+
Note that if the Bicep module references a module in a Private Registry, the ACR endpoint will be visible. To hide the full endpoint, you can configure an alias for the private registry.
99+
76100
## View files in registry
77101

78102
To see the published module in the portal:
79103

80104
1. Sign in to the [Azure portal](https://portal.azure.com).
81105
1. Search for **container registries**.
82106
1. Select your registry.
83-
1. Select **Repositories** from the left menu.
107+
1. Select **Services** -> **Repositories** from the left menu.
84108
1. Select the module path (repository). In the preceding example, the module path name is **bicep/modules/storage**.
85109
1. Select the tag. In the preceding example, the tag is **v1**.
86110
1. The **Artifact reference** matches the reference you'll use in the Bicep file.

articles/azure-resource-manager/bicep/visual-studio-code.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Create Bicep files by using Visual Studio Code
33
description: Describes how to create Bicep files by using Visual Studio Code
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 06/05/2023
6+
ms.date: 05/10/2024
77
---
88

99
# Create Bicep files by using Visual Studio Code
@@ -121,10 +121,14 @@ When your Bicep file uses modules that are published to a registry, the restore
121121

122122
## View type document
123123

124-
From Visual Studio Code, you can easily open the template reference for the resource type you're working on. To do so, hover your cursor over the resource symbolic name, and then select **View type document**.
124+
From Visual Studio Code, you can open the template reference for the resource type you're working on. To do so, hover your cursor over the resource symbolic name, and then select **View type document**.
125125

126126
:::image type="content" source="./media/visual-studio-code/visual-studio-code-bicep-view-type-document.png" alt-text="Screenshot of Visual Studio Code Bicep view type document.":::
127127

128+
## Go to definition
129+
130+
When defining a [module](./modules.md), regardless of the types of the referenced file - whether it is a local file, module registry file, template spec, you can open the referenced file by selecting or highlighting the module path and then press **[F12]**. If the referenced file is an [Azure Verified Modules(AVM)](https://aka.ms/avm), you can toggle between compiled JSON or Bicep file. To be able to open the Bicep file of a private registry module, ensure that the module is published to the registry with the `WithSource` switch enabled. For more information, see [Publish files to registry](./private-module-registry.md#publish-files-to-registry). The Visual Studio Code Bicep extension version 0.27.1 or newer is required for opening Bicep file from private module registry.
131+
128132
## Paste as Bicep
129133

130134
You can paste a JSON snippet from an ARM template to Bicep file. Visual Studio Code automatically decompiles the JSON to Bicep. This feature is only available with the Bicep extension version 0.14.0 or newer. This feature is enabled by default. To disable the feature, see [VS Code and Bicep extension](./install.md#visual-studio-code-and-bicep-extension).

0 commit comments

Comments
 (0)