Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.21k stars 3.82k forks source link

Update-AzEventGridPartnerTopic does not work when trying to add managed identities. #22351

Open mkrasuskipgs opened 1 year ago

mkrasuskipgs commented 1 year ago

Description

Update-AzEventGridPartnerTopic does not work when trying to add managed identities.

Error is here: https://github.com/Azure/azure-powershell/blob/7407fb00a5c87de5dcc5725a737561049d08a967/src/EventGrid/EventGrid/Utilities/EventGridClient.cs#L2875C21-L2875C21

Issue script & Debug output

PS> [string[]]$identities = "/subscriptions/..."
PS> Update-AzEventGridPartnerTopic -ResourceGroupName "rg" -Name "topic" -IdentityId $identities -IdentityType UserAssigned
PS> Update-AzEventGridPartnerTopic: Object reference not set to an instance of an object.

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.5
PSEdition                      Core
GitCommitId                    7.3.5
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     10.1.0                Az                                  Core,Desk

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     10.1.0                Az                                  Core,Desk

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------

Script     2.12.4                Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script     1.6.0                 Az.EventGrid                        {Enable-AzEventGridPartnerTopic, Get-AzEventGridChannel, Get-AzEventGridDomain, Get-AzEventGridDomainKey…}

Error output

Message        : Object reference not set to an instance of an object.
StackTrace     :    at Microsoft.Azure.Commands.EventGrid.EventGridClient.UpdatePartnerTopic(String resourceGroupName, String partnerTopicName, String identityType, IDictionary`2 userAssignedIdentities, Dictionary`2 tags)
                    at Microsoft.Azure.Commands.EventGrid.UpdateAzureEventGridPartnerTopic.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronouslyOrAsJob>b__3_0(T c)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.NullReferenceException
InvocationInfo : {Update-AzEventGridPartnerTopic}
Line           : Update-AzEventGridPartnerTopic -InputObject $topic -IdentityId $identityIds -IdentityType UserAssigned -Verbose
Position       : At line:1 char:1
                 + Update-AzEventGridPartnerTopic -InputObject $topic -IdentityId $ident …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 15
ghost commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jfggdl.

Issue Details
### Description Update-AzEventGridPartnerTopic does not work when trying to add managed identities. Error is here: https://github.com/Azure/azure-powershell/blob/7407fb00a5c87de5dcc5725a737561049d08a967/src/EventGrid/EventGrid/Utilities/EventGridClient.cs#L2875C21-L2875C21 ### Issue script & Debug output ```PowerShell PS> [string[]]$identities = "/subscriptions/..." PS> Update-AzEventGridPartnerTopic -ResourceGroupName "rg" -Name "topic" -IdentityId $identities -IdentityType UserAssigned PS> Update-AzEventGridPartnerTopic: Object reference not set to an instance of an object. ``` ### Environment data ```PowerShell Name Value ---- ----- PSVersion 7.3.5 PSEdition Core GitCommitId 7.3.5 OS Microsoft Windows 10.0.19044 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0 ``` ### Module versions ```PowerShell ModuleType Version PreRelease Name PSEdition ExportedCommands ---------- ------- ---------- ---- --------- ---------------- Script 10.1.0 Az Core,Desk ModuleType Version PreRelease Name PSEdition ExportedCommands ---------- ------- ---------- ---- --------- ---------------- Script 10.1.0 Az Core,Desk ModuleType Version PreRelease Name PSEdition ExportedCommands ---------- ------- ---------- ---- --------- ---------------- Script 2.12.4 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…} Script 1.6.0 Az.EventGrid {Enable-AzEventGridPartnerTopic, Get-AzEventGridChannel, Get-AzEventGridDomain, Get-AzEventGridDomainKey…} ``` ### Error output ```PowerShell Message : Object reference not set to an instance of an object. StackTrace : at Microsoft.Azure.Commands.EventGrid.EventGridClient.UpdatePartnerTopic(String resourceGroupName, String partnerTopicName, String identityType, IDictionary`2 userAssignedIdentities, Dictionary`2 tags) at Microsoft.Azure.Commands.EventGrid.UpdateAzureEventGridPartnerTopic.ExecuteCmdlet() at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.b__3_0(T c) at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor) at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet) at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord() Exception : System.NullReferenceException InvocationInfo : {Update-AzEventGridPartnerTopic} Line : Update-AzEventGridPartnerTopic -InputObject $topic -IdentityId $identityIds -IdentityType UserAssigned -Verbose Position : At line:1 char:1 + Update-AzEventGridPartnerTopic -InputObject $topic -IdentityId $ident … + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HistoryId : 15 ```
Author: mkrasuskipgs
Assignees: -
Labels: `Event Grid`, `Service Attention`, `bug`, `customer-reported`
Milestone: -