Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Az PowerShell Bicep support feedback #14289

Closed
StefanIvemo opened this issue Feb 23, 2021 · 8 comments · Fixed by #14449
Closed

Az PowerShell Bicep support feedback #14289

StefanIvemo opened this issue Feb 23, 2021 · 8 comments · Fixed by #14449
Assignees
Labels
customer-reported feature-request This issue requires a new behavior in the product in order be resolved. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@StefanIvemo
Copy link
Contributor

I looked at the code implemented so far to support the deployment of .bicep files using the New-Az*Deployment cmdlets and have some feedback.

Looking at src/Resources/ResourceManager/Utilities/BicepUtility.cs I see some potential issues.

There is no check to verify which version of Bicep CLI is running on the device. There should be a check that verifies the version installed and specify a minimum required version of Bicep CLI. If the version is not up to date, the user should get a Warning and be prompted to update the CLI. If older versions of bicep is installed there is a risk that build will run successfully but the deployment using the compiled .json will fail. This is extra important if the bicep support should be aligned with the release of Bicep v0.3.

The error message if bicep is not installed in src/Resources/ResourceManager/Properties/Resources.resx should link to https://github.com/Azure/bicep/blob/main/docs/installing.md#install-the-bicep-cli instead of releases in the git repo. It is not clear how to install bicep using the assets in the release. Only the Windows Installer will actually install the CLI and add Bicep to the users path. Or even better create cmdlets to Install/Update/Remove bicep CLI using the Az Module. If Bicep CLI is a requirement for the deployment of .bicep files with the Az module the module should provide tools to install the dependencies.

<data name="BicepNotFound" xml:space="preserve">
     <value>Cannot find Bicep. Please add Bicep to your PATH or visit https://github.com/Azure/bicep/releases to install Bicep.</value>
</data>
@StefanIvemo StefanIvemo added the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Feb 23, 2021
@ghost ghost added question The issue doesn't require a change to the product in order to be resolved. Most issues start as that customer-reported labels Feb 23, 2021
@dingmeng-xue dingmeng-xue removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Feb 24, 2021
@dingmeng-xue
Copy link
Member

@StefanIvemo , Thanks for suggestion. We will change the link in this upcoming release.

Creating cmdlets to support Install/Update/Remove tool from customer environment is out of the scope of Azure PowerShell. I prefer to asking PowerShell to support that in a generic way.

Regarding to the version of Bicep, we are hesitating to support it because Becip is still under preview and Azure PowerShell shouldn't install it on behave of customer. And we didn't figure out the way to check which version is expected. Feel free to share your insight.

@dingmeng-xue dingmeng-xue added the feature-request This issue requires a new behavior in the product in order be resolved. label Feb 24, 2021
@StefanIvemo
Copy link
Contributor Author

StefanIvemo commented Feb 24, 2021

@dingmeng-xue

I have changed my mind on the version check. It should be up to the user to decide which version of Bicep to use. If I have authored all my bicep templates using a specific release for example v0.2.212, then I should be able to use that version to deploy my .bicep files. A newer release might implement breaking changes that causes my template to brake if I'm forced to use a newer version. New-Az*Deployment can just verify that I have Bicep installed and then try to deploy my template.

I do believe that it could be a good idea though to inform the user which Bicep version is used during deployment, at least if I'm using the -Verbose switch. And also any build warnings generated from bicep build should be outputted as well.

Running New-AzResourceGroupDeployment -ResourceGroupName nsgs-rg -TemplateFile .\nsg-1.bicep -TemplateParameterFile .\nsg-1.parameters.json -Verbose , should generate an output like:

VERBOSE: Using Bicep release v0.2.328
VERBOSE: Warning BCP081: Resource type "Microsoft.Network/networkSecurityGroups@2020-08-01" does not have types available.
VERBOSE: Performing the operation "Creating Deployment" on target "nsgs-rg".
VERBOSE: 21:06:47 - Template is valid.
VERBOSE: 21:06:48 - Create template deployment 'nsg-1'
VERBOSE: 21:06:48 - Checking deployment status in 5 seconds
VERBOSE: 21:06:53 - Resource Microsoft.Network/networkSecurityGroups 'steffes-super-cool-nsg' provisioning status is succeeded

Any thoughts on this @alex-frankel?

@dcaro
Copy link
Contributor

dcaro commented Feb 25, 2021

@StefanIvemo / @alex-frankel I think it is possible to redirect the output of bicep to the verbose / debug stream of the PowerShell cmdlet. Would this be acceptable?
Let us know If you have other ideas.

@alex-frankel
Copy link

I think that is a good idea. Could we also add the bicep version that is being used? That is not something we output with the bicep CLI today.

@StefanIvemo
Copy link
Contributor Author

I'd be happy if we could get something similar to my example above. Output Bicep version and any build warnings. I believe that information can be useful in a couple of scenarios.

@alex-frankel
Copy link

@StefanIvemo - bicep CLI will emit any errors or warnings, so I think we only need to add the version to the output to match what you have above. WDYT?

@StefanIvemo
Copy link
Contributor Author

@alex-frankel Ok! Version should be enough then.

@BethanyZhou BethanyZhou added this to the S184 (2021-03-23) milestone Feb 26, 2021
@BethanyZhou
Copy link
Contributor

BethanyZhou commented Feb 26, 2021

The link has been changed to https://github.com/Azure/bicep/blob/main/docs/installing.md in this upcoming release.
We plan to redirect the output of bicep to the verbose/debug stream and add bicep version to output in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported feature-request This issue requires a new behavior in the product in order be resolved. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
5 participants