diff --git a/src/Accounts/Accounts/ChangeLog.md b/src/Accounts/Accounts/ChangeLog.md index 55e233064c21..3cba715683dc 100644 --- a/src/Accounts/Accounts/ChangeLog.md +++ b/src/Accounts/Accounts/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Fixed null reference and method case insensitive in `Invoke-AzRestMethod` * [Breaking Change] Removed `Get-AzProfile` and `Select-AzProfile` * Updated Azure.Core to 1.5.1 diff --git a/src/Accounts/Accounts/Rest/InvokeAzRestMethodCommand.cs b/src/Accounts/Accounts/Rest/InvokeAzRestMethodCommand.cs index 9071ab199065..7500c2ace7f7 100644 --- a/src/Accounts/Accounts/Rest/InvokeAzRestMethodCommand.cs +++ b/src/Accounts/Accounts/Rest/InvokeAzRestMethodCommand.cs @@ -108,7 +108,7 @@ public override void ExecuteCmdlet() this.Path = ConstructPath(this.IsParameterBound(c => c.SubscriptionId) ? this.SubscriptionId : context.Subscription.Id, this.ResourceGroupName, this.ResourceProviderName, this.ResourceType, this.Name); } - switch (this.Method) + switch (this.Method.ToUpper()) { case "GET": response = ServiceClient @@ -197,7 +197,7 @@ private string ConstructPath(string sub, string rg, string rp, string[] types, s for (int i = 0; i < types.Length; i++) { sb.Append(slash + types[i]); - if (i != names.Length) + if (names != null && i != names.Length) { sb.Append(slash + names[i]); } @@ -206,4 +206,4 @@ private string ConstructPath(string sub, string rg, string rp, string[] types, s return sb.ToString(); } } -} \ No newline at end of file +}