azure-powershell
azure-powershell copied to clipboard
Az.Resources: AzDeployment cmdlets emit an empty WARNING line
Description
The AzDeployment cmdlets (including New-AzSubscriptionDeployment, Test-AzSubscriptionDeployment, etc.) consistently emit an unexpected empty WARNING line to the console when using any Bicep input files that do not contain any errors or warnings.
PS> Set-Content -Path hello.bicep -Value "output hello string = 'hello'"
PS> Test-AzSubscriptionDeployment -Location japaneast -TemplateFile ./hello.bicep
WARNING:
PS> Test-AzSubscriptionDeployment -Verbose -Location japaneast -TemplateFile ./hello.bicep
VERBOSE: Using Bicep v0.25.3
VERBOSE: Calling Bicep with arguments: build "/workspaces/dxcloud-iac/hello.bicep" --stdout
WARNING:
VERBOSE: 1:04:35 PM - Template is valid.
The Bicep process does not output any errors or warnings to stderr.
PS> bicep build ./hello.bicep --stdout >stdout 2>stderr
PS> ls -l std*
-rw-rw-rw- 1 vscode vscode 0 Feb 12 13:10 stderr
-rw-rw-rw- 1 vscode vscode 384 Feb 12 13:10 stdout
No WARNING lines should be expected when valid Bicep inputs without any errors or warnings are used.
Issue script & Debug output
PS> $DebugPreference = 'Continue'
PS> Set-Content -Path hello.bicep -Value "output hello string = 'hello'"
PS> Test-AzSubscriptionDeployment -Verbose -Location japaneast -TemplateFile ./hello.bicep
VERBOSE: Using Bicep v0.25.3
VERBOSE: Calling Bicep with arguments: build "/workspaces/dxcloud-iac/hello.bicep" --stdout
WARNING:
DEBUG: 12:45:16 PM - TestAzureSubscriptionDeploymentCmdlet begin processing with ParameterSet 'ByTemplateFileWithNoParameters'.
DEBUG: 12:45:16 PM - using account id 'azure-cli'...
DEBUG: 12:45:16 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
https://management.azure.com/subscriptions/57e3d747-fe92-4334-bb7a-9648d518adeb/providers/Microsoft.Resources/deployments/6c885142-9cd0-48bf-81c5-47dfb71d61ce/validate?api-version=2022-09-01
Headers:
Accept-Language : en-US
x-ms-client-request-id : abc5e568-d735-49a0-aecc-d2b7b2c38e38
Body:
{
"location": "japaneast",
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"resources": [],
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.25.3.34343",
"templateHash": "16951429577663310116"
}
},
"outputs": {
"hello": {
"type": "string",
"value": "hello"
}
}
},
"parameters": {},
"mode": "Incremental"
}
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Cache-Control : no-cache
Pragma : no-cache
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-request-id : 8ebed6bd-b119-473d-9b41-469a5869b0d9
x-ms-correlation-request-id : 8ebed6bd-b119-473d-9b41-469a5869b0d9
x-ms-routing-request-id : SOUTHEASTASIA:20240212T124517Z:8ebed6bd-b119-473d-9b41-469a5869b0d9
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
X-Cache : CONFIG_NOCACHE
X-MSEdge-Ref : Ref A: 0EE895BE5C434162A2BD02FA6EBDBC7F Ref B: MAA201060513011 Ref C: 2024-02-12T12:45:17Z
Date : Mon, 12 Feb 2024 12:45:16 GMT
Body:
{
"id": "/subscriptions/57e3d747-fe92-4334-bb7a-9648d518adeb/providers/Microsoft.Resources/deployments/6c885142-9cd0-48bf-81c5-47dfb71d61ce",
"name": "6c885142-9cd0-48bf-81c5-47dfb71d61ce",
"type": "Microsoft.Resources/deployments",
"location": "japaneast",
"properties": {
"templateHash": "16951429577663310116",
"mode": "Incremental",
"provisioningState": "Succeeded",
"timestamp": "0001-01-01T00:00:00Z",
"duration": "PT0S",
"correlationId": "8ebed6bd-b119-473d-9b41-469a5869b0d9",
"providers": [],
"dependencies": [],
"validatedResources": []
}
}
VERBOSE: 12:45:17 PM - Template is valid.
DEBUG: 12:45:17 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:45:17 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent: Module: Az.Resources:6.15.1; CommandName: Test-AzDeployment; PSVersion: 7.4.1; IsSuccess: True; Duration: 00:00:00.5831028
DEBUG: 12:45:17 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:45:17 PM - TestAzureSubscriptionDeploymentCmdlet end processing.
Environment data
PS> $PSVersionTable
Name Value
---- -----
PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS Ubuntu 22.04.3 LTS
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Module versions
PS> Get-Module Az*
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.15.1 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 7.1.1 Az.Compute {Add-AzImageDataDisk, Add-AzVhd, Add-AzVMAdditionalUnattendContent, Add-AzVMDataDisk…}
Script 4.3.0 Az.DesktopVirtualization {Disconnect-AzWvdUserSession, Expand-AzWvdMsixImage, Get-AzWvdApplication, Get-AzWvdApplicationGroup…}
Script 0.4.0 Az.ImageBuilder {Get-AzImageBuilderTemplate, Get-AzImageBuilderTemplateRunOutput, Get-AzImageBuilderTrigger, New-AzImageBuilderTempl…
Script 5.2.0 Az.KeyVault {Add-AzKeyVaultCertificate, Add-AzKeyVaultCertificateContact, Add-AzKeyVaultKey, Add-AzKeyVaultManagedStorageAccount…
Script 7.4.0 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Add-AzApplicationGatewayBackendAddressPool, Add-AzApplicationGat…
Script 6.15.1 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}
Error output
No response
The suspicious part in BicepUtility.cs:
https://github.com/Azure/azure-powershell/blob/52f9aad305752fc419c6013b10f9127c243f34d4/src/Resources/ResourceManager/Utilities/BicepUtility.cs#L214-L218
Thanks for the feedback. Let me loop in deployment team.
One possibility is that output.Stderr
contained whitespace characters.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/deployments-owners.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/deployments-owners.
I'm seeing the same thing. Thank goodness I came across this issue because I thought I was going crazy!