Azure / deployment-stacks

Contains Deployment Stacks CLI scripts and releases

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When you use Az PowerShell to deploy deployment stack with Bicep template and parameters files you get warning/errors twice.

slavizh opened this issue · comments

Describe the bug
When you use Az PowerShell to deploy deployment stack with Bicep template and parameters files you get warning/errors twice.

image

To Reproduce
Deployment of bicep template with bicep parameters file

Expected behavior
To show warnings once as these warnings are for the template only.

Screenshots
provided

Repro Environment
Host OS: Linux Ubuntu 20.04
Powershell Version: 7.2

commented

Is this just happening when the verbose flag is passed in? Would you mind sharing the exact command + parameters that led to this output?

yeah with verbose. I have noticed same behavior with regular deployment commands. For me the best experience would be to have any warnings or errors once and if you have warnings on Bicep Parameters file and on Bicep template to have clear separation to know from there it is coming.

$deploymentStackParameters = @{
            Name                           = $deploymentStackName
            Description                    = $deploymentStackDescription
            Location                       = $deploymentLocation
            TemplateParameterFile          = $bicepParametersFullFilePath
            TemplateFile                   = $bicepMainTemplateFilePath
            DenySettingsMode               = $deploymentStackDenySettingsMode
            DenySettingsApplyToChildScopes = $deploymentStackDenySettingsApplyToChildScopes
            DenySettingsExcludedAction     = $deploymentStackDenySettingsExcludedActions
            DenySettingsExcludedPrincipal  = $deploymentStackDenySettingsExcludedPrincipals
            Force                          = $true
            Verbose                        = $true
            ErrorAction                    = 'SilentlyContinue'
            ErrorVariable                  = 'deploymentError'
        }
$deploymentOutput = New-AzSubscriptionDeploymentStack @deploymentStackParameters

It happens on any command as long as you are deploying Bicep template with Bicep parameters file

Hi @slavizh - the duplicate output seen in verbose is by design. The reason for this is because the service expects a JSON file for both the Bicep and Bicepparam files, therefore every time the client compiles the BICEP into a JSON file, verbose output is produced. The client is not aware of whether the JSON file is the template or the parameter file, and therefore uses the same bicep module for conversion of both the template and parameter file.

ok this is by design but for me this is not good experience to show the same warnings for the same files twice.