Azure / Azure/azure-powershell

Error Supplying SkuName to Set-AzServiceBusNamespace

Open Beginner friendly
#25,910 4 comments 0 reactions 0 assignees View on GitHub
act-observability-squad bug customer-reported Service Attention Service Bus
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

### Description

When calling Set-AzServiceBusNamespace with -SkuName, I receive the error:
```
A parameter cannot be found that matches parameter name 'SkuName'
At C:\Program
Files\WindowsPowerShell\Modules\Az.ServiceBus\4.0.0\ServiceBus.Autorest\custom\Set-AzServiceBusNamespace.ps1:180
char:66
+ ... $serviceBusNamespace = Get-AzServiceBusNamespace @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-AzServiceBusNamespace], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : NamedParameterNotFound,Get-AzServiceBusNamespace
```

This appears to be caused because $PSBoundParameters.Remove is not being called for SkuName like it is for other parameters.

### Issue script & Debug output

```PowerShell
Set-AzServiceBusNamespace `
-Name `
-ResourceGroupName `
-SkuName Basic
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 5.1.22621.3958
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.3958
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```

### Module versions

```PowerShell
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 3.0.3 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear...
Script 4.0.0 Az.ServiceBus {New-AzServiceBusAuthorizationRuleSASToken, Test-AzService..
```

### Error output

```PowerShell
DEBUG: 3:55:20 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning
default value [True].
DEBUG: 3:55:20 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 3:55:20 PM - using account id ''...
DEBUG: 3:55:20 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = [].
Returning default value [True].
DEBUG: 3:55:20 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning
default value [True].

HistoryId: 13

Message : A parameter cannot be found that matches parameter name 'SkuName'.
StackTrace : at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception&
exceptionThrown, ExecutionOptions options)
Exception : System.Management.Automation.ParameterBindingException
InvocationInfo : {Get-AzServiceBusNamespace}
Line : $serviceBusNamespace = Get-AzServiceBusNamespace @PSBoundParameters

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.ServiceBus\4.0.0\ServiceBus.Autorest\custom\Set-AzSer
viceBusNamespace.ps1:180 char:66
+ ... $serviceBusNamespace = Get-AzServiceBusNamespace @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~
HistoryId : 13

DEBUG: 3:55:20 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning
default value [True].

HistoryId: 10

Message : A parameter cannot be found that matches parameter name 'SkuName'.
StackTrace : at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception&
exceptionThrown, ExecutionOptions options)
Exception : System.Management.Automation.ParameterBindingException
InvocationInfo : {Get-AzServiceBusNamespace}
Line : $serviceBusNamespace = Get-AzServiceBusNamespace @PSBoundParameters

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.ServiceBus\4.0.0\ServiceBus.Autorest\custom\Set-AzSer
viceBusNamespace.ps1:180 char:66
+ ... $serviceBusNamespace = Get-AzServiceBusNamespace @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~
HistoryId : 10

DEBUG: 3:55:20 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning
default value [True].

HistoryId: 8

Message : A parameter cannot be found that matches parameter name 'SkuName'.
StackTrace : at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception&
exceptionThrown, ExecutionOptions options)
Exception : System.Management.Automation.ParameterBindingException
InvocationInfo : {Get-AzServiceBusNamespace}
Line : $serviceBusNamespace = Get-AzServiceBusNamespace @PSBoundParameters

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.ServiceBus\4.0.0\ServiceBus.Autorest\custom\Set-AzSer
viceBusNamespace.ps1:180 char:66
+ ... $serviceBusNamespace = Get-AzServiceBusNamespace @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~
HistoryId : 8

DEBUG: 3:55:20 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning
default value [True].

HistoryId: 6

Message : A parameter cannot be found that matches parameter name 'SkuName'.
StackTrace : at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception&
exceptionThrown, ExecutionOptions options)
Exception : System.Management.Automation.ParameterBindingException
InvocationInfo : {Get-AzServiceBusNamespace}
Line : $serviceBusNamespace = Get-AzServiceBusNamespace @PSBoundParameters

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.ServiceBus\4.0.0\ServiceBus.Autorest\custom\Set-AzSer
viceBusNamespace.ps1:180 char:66
+ ... $serviceBusNamespace = Get-AzServiceBusNamespace @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~
HistoryId : 6

DEBUG: 3:55:20 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning
default value [True].

HistoryId: 5

Message : A parameter cannot be found that matches parameter name 'SkuName'.
StackTrace : at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception&
exceptionThrown, ExecutionOptions options)
Exception : System.Management.Automation.ParameterBindingException
InvocationInfo : {Get-AzServiceBusNamespace}
Line : $serviceBusNamespace = Get-AzServiceBusNamespace @PSBoundParameters

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.ServiceBus\4.0.0\ServiceBus.Autorest\custom\Set-AzSer
viceBusNamespace.ps1:180 char:66
+ ... $serviceBusNamespace = Get-AzServiceBusNamespace @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~
HistoryId : 5

DEBUG: 3:55:20 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning
default value [True].

HistoryId: 4

Message : Parameter cannot be processed because the parameter name 'Sku' is ambiguous. Possible matches
include: -SkuName -SkuCapacity.
StackTrace : at System.Management.Automation.MergedCommandParameterMetadata.GetMatchingParameter(String name,
Boolean throwOnParameterNotFound, Boolean tryExactMatching, InvocationInfo invocationInfo)
at System.Management.Automation.ParameterBinderController.ReparseUnboundArguments()
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 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 : {Set-AzServiceBusNamespace}
Line : -Sku Basic
Position : At line:4 char:4
+ -Sku Basic
+ ~~~~
HistoryId : 4

DEBUG: 3:55:20 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning
default value [True].

HistoryId: 3

Message : A parameter cannot be found that matches parameter name 'SkuName'.
StackTrace : at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception&
exceptionThrown, ExecutionOptions options)
Exception : System.Management.Automation.ParameterBindingException
InvocationInfo : {Get-AzServiceBusNamespace}
Line : $serviceBusNamespace = Get-AzServiceBusNamespace @PSBoundParameters

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.ServiceBus\4.0.0\ServiceBus.Autorest\custom\Set-AzSer
viceBusNamespace.ps1:180 char:66
+ ... $serviceBusNamespace = Get-AzServiceBusNamespace @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~
HistoryId : 3

DEBUG: 3:55:20 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning
default value [True].
DEBUG: 3:55:20 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default
value [True].
DEBUG: AzureQoSEvent: Module: Az.Accounts:3.0.3; CommandName: Resolve-AzError; PSVersion: 5.1.22621.3958; IsSuccess:
True; Duration: 00:00:00.0943703; SanitizeDuration: 00:00:00.0057296
DEBUG: 3:55:20 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning
default value [True].
DEBUG: 3:55:20 PM - ResolveError end processing.
```

Contributor guide

Open the contributing guide

Research direction

Start in ServiceBus.Autorest/custom/Set-AzServiceBusNamespace.ps1 at line 180, where $PSBoundParameters is splatted into Get-AzServiceBusNamespace, and compare the handling of SkuName with the other parameters. Re-run the supplied Set-AzServiceBusNamespace command with -SkuName Basic; done means it no longer passes SkuName to Get-AzServiceBusNamespace and the namespace update proceeds without the reported binding error.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
cli, cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.