-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
ARMcustomer-reportedquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone
Description
Description
On certain bicep configurations with modules, something fails in the bicep compilation step that Powershell uses and it gets wrapped in a dynamic error. It appears the secondary bicep modules do not get copied correctly to the temp area.
However, if you compile the same .bicep configuration with bicep
and then specify the json instead, it works fine.
Steps to reproduce
New-AzResourceGroupDeployment -TemplateFile .\main.bicep
Environment data
Name Value
---- -----
PSVersion 5.1.19041.610
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.610
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Module versions
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 3.3.0 Az.Resources {Add-AzADGroupMember, Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzADAppCredential...}
Debug output
No Debug Output
Error output
HistoryId: 1
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.BindCommandLineParametersNoValidation(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 where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
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 .\main.bicep -TemplateParameterFile C:\Users\JGrote\desktop\SHAZUFGTest.parameters.json -Name SHAZUFGTest
-ResourceGroupName SHAZUFortigateLab -Verbose
Position : At line:1 char:1
+ New-AzResourceGroupDeployment -TemplateFile .\main.bicep -TemplatePar ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 1
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.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state)
at System.Management.Automation.MshCommandRuntime.WriteError(ErrorRecord errorRecord, Boolean overrideInquire)
at System.Management.Automation.Cmdlet.WriteError(ErrorRecord errorRecord)
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 System.Management.Automation.CmdletParameterBinderController.HandleCommandLineDynamicParameters(ParameterBindingException& outgoingBindingException)
Exception : System.Management.Automation.PSInvalidOperationException
InvocationInfo : {New-AzResourceGroupDeployment}
Line : New-AzResourceGroupDeployment -TemplateFile .\main.bicep -TemplateParameterFile C:\Users\JGrote\desktop\SHAZUFGTest.parameters.json -Name SHAZUFGTest
-ResourceGroupName SHAZUFortigateLab -Verbose
Position : At line:1 char:1
+ New-AzResourceGroupDeployment -TemplateFile .\main.bicep -TemplatePar ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 1
HistoryId: -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(325,105) : Error BCP062: The referenced declaration with name "fqdn" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(325,78) : Error BCP062: The referenced declaration with name "fortigateB" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(324,105) : Error BCP062: The referenced declaration with name "fqdn" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(324,78) : Error BCP062: The referenced declaration with name "fortigateA" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(316,44) : Error BCP062: The referenced declaration with name "baseSsh" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(315,44) : Error BCP062: The referenced declaration with name "baseSsh" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(314,37) : Error BCP062: The referenced declaration with name "baseUri" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(313,37) : Error BCP062: The referenced declaration with name "baseUri" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(311,39) : Error BCP062: The referenced declaration with name "fqdn" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(310,26) : Error BCP062: The referenced declaration with name "fqdn" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(309,12) : Error BCP062: The referenced declaration with name "loadbalancer" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(287,19) : Error BCP091: An error occurred reading file. Could not find file
'C:\Users\JGrote\AppData\Local\Temp\fortigate.bicep'.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(265,19) : Error BCP091: An error occurred reading file. Could not find file
'C:\Users\JGrote\AppData\Local\Temp\fortigate.bicep'.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(249,21) : Error BCP091: An error occurred reading file. Could not find file
'C:\Users\JGrote\AppData\Local\Temp\loadbalancer.bicep'.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(248,197) : Error BCP062: The referenced declaration with name "network" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(248,28) : Error BCP062: The referenced declaration with name "network" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(247,197) : Error BCP062: The referenced declaration with name "network" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(247,28) : Error BCP062: The referenced declaration with name "network" is not valid.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {bicep.exe}
Line : bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
Position : At line:1 char:1
+ bicep build 'C:\Users\JGrote\AppData\Local\Temp\main.bicep'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
HistoryId: 1
Message : C:\Users\JGrote\AppData\Local\Temp\main.bicep(235,16) : Error BCP091: An error occurred reading file. Could not find file
'C:\Users\JGrote\AppData\Local\Temp\network.bicep'.
StackTrace :
Exception : System.Management.Automation.RemoteException
InvocationInfo : {New-AzResourceGroupDeployment}
Line : New-AzResourceGroupDeployment -TemplateFile .\main.bicep -TemplateParameterFile C:\Users\JGrote\desktop\SHAZUFGTest.parameters.json -Name SHAZUFGTest
-ResourceGroupName SHAZUFortigateLab -Verbose
Position : At line:1 char:1
+ New-AzResourceGroupDeployment -TemplateFile .\main.bicep -TemplatePar ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 1
The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.
Notes
Bicep errors should have a more specific catch to output the bicep error
Bicep Template with Issue (branch)
https://github.com/JustinGrote/FortigateAzureHA/tree/bicepAzureIssue
Metadata
Metadata
Assignees
Labels
ARMcustomer-reportedquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that