-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Closed
Copy link
Labels
ARMfeature-requestThis issue requires a new behavior in the product in order be resolved.This issue requires a new behavior in the product in order be resolved.
Milestone
Description
Description
The deployment cmdlet won't work if a Bicep file contains errors. I would expect it to print out the compilation errors. Also, if a Bicep file is valid but has warnings, the warnings will not be printed.
Steps to reproduce
> New-AzResourceGroupDeployment -TemplateFile .\withErrors.bicep -ResourceGroupName test
New-AzResourceGroupDeployment: Cannot retrieve the dynamic parameters for the cmdlet. The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing methods, and they can only be called from within the same thread. Validate that the cmdlet makes these calls correctly, or contact Microsoft Customer Support Services.
Environment data
Module versions
Name Value
---- -----
PSVersion 7.1.2
PSEdition Core
GitCommitId 7.1.2
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Debug output
~\Desktop\bicep-bugbash
> $DebugPreference='Continue'
~\Desktop\bicep-bugbash
> New-AzResourceGroupDeployment -TemplateFile .\withErrors.bicep -ResourceGroupName test -Debug
New-AzResourceGroupDeployment: Cannot retrieve the dynamic parameters for the cmdlet. The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing methods, and they can only be called from within the same thread. Validate that the cmdlet makes these calls correctly, or contact Microsoft Customer Support Services.
Error output
DEBUG: 10:25:07 AM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 10:25:07 AM - using account id '[email protected]'...
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release. Please change any scripts that use this alias to use `Resolve-AzError` instead.
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.
HistoryId: 20
Message : Cannot retrieve the dynamic parameters for the cmdlet. The WriteObject and WriteError methods cannot
be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing
methods, and they can only be called from within the same thread. Validate that the cmdlet makes
these calls correctly, or contact Microsoft Customer Support Services.
StackTrace : at System.Management.Automation.CmdletParameterBinderController.HandleCommandLineDynamicParameters(
ParameterBindingException& outgoingBindingException)
at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidati
on(Collection`1 arguments)
at
System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1
arguments)
at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary
psDefaultParameterValues)
at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object
input)
--- End of stack trace from previous location ---
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object
input)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput,
CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][]
commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
Exception : System.Management.Automation.ParameterBindingException
InvocationInfo : {New-AzResourceGroupDeployment}
Line : New-AzResourceGroupDeployment -TemplateFile .\withError.bicep -ResourceGroupName test
Position : At line:1 char:1
+ New-AzResourceGroupDeployment -TemplateFile .\withError.bicep -Resour …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 20
Message : The WriteObject and WriteError methods cannot be called from outside the overrides of the
BeginProcessing, ProcessRecord, and EndProcessing methods, and they can only be called from within
the same thread. Validate that the cmdlet makes these calls correctly, or contact Microsoft Customer
Support Services.
StackTrace : at System.Management.Automation.MshCommandRuntime.ThrowIfWriteNotPermitted(Boolean
needsToWriteToPipeline)
at System.Management.Automation.MshCommandRuntime.DoWriteError(Object obj)
at System.Management.Automation.MshCommandRuntime.WriteError(ErrorRecord errorRecord, Boolean
overrideInquire)
at System.Management.Automation.MshCommandRuntime.WriteError(ErrorRecord errorRecord)
at System.Management.Automation.Cmdlet.WriteError(ErrorRecord errorRecord)
at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__DisplayClass14_0`1.<Execu
teScript>b__0(ErrorRecord e)
at Microsoft.WindowsAzure.Commands.Utilities.Common.GeneralUtilities.ForEach[T](IEnumerable`1
sequence, Action`1 action)
at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteScript[T](PSCmdlet
cmdlet, String contents)
at
Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities.BicepUtility.BuildFile[T](ScriptExecutor`1
executeScript, String bicepTemplateFilePath)
at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceWithParameterCmdletBase.
BuildAndUseBicepTemplate()
at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceWithParameterCmdletBase.
GetDynamicParameters()
at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.CmdletBase.DeploymentCreateCmdle
t.GetDynamicParameters()
at System.Management.Automation.CmdletParameterBinderController.HandleCommandLineDynamicParameters(
ParameterBindingException& outgoingBindingException)
Exception : System.Management.Automation.PSInvalidOperationException
InvocationInfo : {New-AzResourceGroupDeployment}
Line : New-AzResourceGroupDeployment -TemplateFile .\withError.bicep -ResourceGroupName test
Position : At line:1 char:1
+ New-AzResourceGroupDeployment -TemplateFile .\withError.bicep -Resour …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 20
Message : C:\Users\Shenglong\AppData\Local\Temp\withError.bicep(1,11) : Error BCP004: The string at this
location is not terminated due to an unexpected new line character.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {New-AzResourceGroupDeployment}
Line : New-AzResourceGroupDeployment -TemplateFile .\withError.bicep -ResourceGroupName test
Position : At line:1 char:1
+ New-AzResourceGroupDeployment -TemplateFile .\withError.bicep -Resour …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 20
Metadata
Metadata
Assignees
Labels
ARMfeature-requestThis issue requires a new behavior in the product in order be resolved.This issue requires a new behavior in the product in order be resolved.