Azure / Azure-Verified-Modules

Azure Verified Modules (AVM) is an initiative to consolidate and set the standards for what a good Infrastructure-as-Code module looks like. Modules will then align to these standards, across languages (Bicep, Terraform etc.) and will then be classified as AVMs and available from their respective language specific registries.
https://aka.ms/AVM
MIT License
279 stars 61 forks source link

Azure Verified Modules in Bicep not resolving modules list in intellisense[Question/Feedback]: #926

Open PhilipAnthonyMurray opened 2 months ago

PhilipAnthonyMurray commented 2 months ago

Check for previous/existing GitHub issues

Description

I have started to look at Azure Verified Modules using Bicep in Visual Studio Code and I'm experiencing an issue getting Intellisense to resolve the modules list.

Creating a test.bicep file and referencing the br/public alias does not show me a list of published modules as I have seen in a couple of demos.

Full Error Message - The OCI artifact reference "br:mcr.microsoft.com/bicep/" after resolving alias "public" is not valid. The artifact path segment "bicep/" is not valid. Each artifact name path segment must be a lowercase alphanumeric string optionally separated by a ".", "_" , or "-".

Azure CLI Version - 2.60.0 Bicep Version - 0.26.170 Visual Studio Code Version - 1.88.1 Bicep Extension Version - 0.26.170

The issue happens on my work laptop on the corporate network but on my personal laptop\network it works as expected. Any idea why it cannot resolve the artifact reference, are there any firewall/proxy settings required for the endpoint?

It's also worth noting that if I manually complete the module reference it downloads it to the .bicep\br folder.

module nsg 'br/public:avm/res/network/network-security-group:0.1.3' = { }

shenglol commented 2 months ago

Hi @PhilipAnthonyMurray, could you verify if you can access https://aka.ms/br-module-index-data and https://live-data.bicep.azure.com/module-index from your corporate network?

PhilipAnthonyMurray commented 2 months ago

Hi @shenglol, yes I can access both in Chrome & Edge on the corp network.

PhilipAnthonyMurray commented 2 months ago

One more point, if I make a resource declaration, as below, intellisense works as expected.

resource aaa 'Microsoft.Web/sites/functions@2023-01-01' = { }

shenglol commented 1 month ago

One more point, if I make a resource declaration, as below, intellisense works as expected.

resource aaa 'Microsoft.Web/sites/functions@2023-01-01' = { }

IntelliSense for resource types in Bicep uses built-in type information within the Bicep compiler, so it works offline.

Hi @shenglol, yes I can access both in Chrome & Edge on the corp network.

This is odd, but I wonder if it's possible that the firewall is blocking requests from VS Code. To check this, you may try accessing the URLs using the REST Client VS Code extension, which you can find and install from here.

Additionally, could you please share the Bicep extension traces to further investigate the issue? Here’s how you can do it:

If you come across any such errors, please copy and share them here so we can help troubleshoot the problem more effectively.

PhilipAnthonyMurray commented 1 month ago

Thanks @shenglol, looks like the issue is relating to a proxy issue on the corp network. We are currently investigating why traffic is blocked in VSCode and Postman but not browsers while on VPN. Thanks for your time on this one.

PhilipAnthonyMurray commented 1 month ago

Hi @shenglol , I have overcome the proxy issue in VSCode and both https://aka.ms/br-module-index-data & https://live-data.bicep.azure.com/module-index return 200 OK responses with data from the VSCode Rest Client extension but it has not resolved the issue with Intellisense.

As requested below is a screen grab of the issue with the Bicep Output window

Untitled

PhilipAnthonyMurray commented 1 month ago

@shenglol, I enabled verbose output and have attached it. From what I can see it's still has issues with "The OCI artifact reference \"br:mcr.microsoft.com/bicep/\" after resolving alias \"public\" is not valid."

verbose.txt

shenglol commented 1 month ago

Can you try triggering code completion with "ctrl + space"? I didn't find any error message regarding module metadata downloading in the language server outputs.

PhilipAnthonyMurray commented 1 month ago

image

shenglol commented 1 month ago

Would you mind sharing a new log file that contains all outputs (including Bicep language service started.)?

PhilipAnthonyMurray commented 1 month ago

@shenglol Full file attached. bicep_log.txt

PhilipAnthonyMurray commented 3 weeks ago

@shenglol , any update on this issue?

PhilipAnthonyMurray commented 2 days ago

@shenglol , any update on this issue?