Skip to content

Update-AzGallery -InputObject <PSGallery> -Share -Tenant<String[]> cannot infer resource group information from input object #29292

@D1v38om83r

Description

@D1v38om83r

Description

Update-AzGallery -InputObject <PSGallery> -Share -Tenant<String[]>
fails with error "Update-AzGallery : 'resourceGroupName' cannot be null."

Issue script & Debug output

$tenantIdsToAdd = @("72f988bf-86f1-4111-9d98-000d3adfbdce")
$galleryWithSharingProfile = Get-AzGallery -Name $GalleryName -ResourceGroupName $ResourceGroup -Expand "SharingProfile/Groups,SharingStatus"
Update-AzGallery -InputObject $galleryWithSharingProfile -Permission "Groups"
Update-AzGallery -InputObject $galleryWithSharingProfile -Share -Tenant $($tenantIdsToAdd -join ',')

Update-AzGallery : 'resourceGroupName' cannot be null.
At Q:\src\Compute-ART-1PVMAppGallery\.pipelines\scripts\Ensure-GalleryExists.ps1:119 char:1
+ Update-AzGallery -InputObject $galleryWithSharingProfile -Share -Tena ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Update-AzGallery], ValidationException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.Automation.UpdateAzureRmGallery

Environment data

$PSVersionTable

Name                           Value                                                                                        
----                           -----                                                                                        
PSVersion                      5.1.26100.7462                                                                               
PSEdition                      Desktop                                                                                      
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                      
BuildVersion                   10.0.26100.7462                                                                              
CLRVersion                     4.0.30319.42000                                                                              
WSManStackVersion              3.0                                                                                          
PSRemotingProtocolVersion      2.3                                                                                          
SerializationVersion           1.1.0.1

Module versions

get-module Az*

ModuleType Version    Name                                ExportedCommands                                                  
---------- -------    ----                                ----------------                                                  
Script     5.3.3      Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDe...
Script     11.4.0     Az.Compute                          {Add-AzGalleryInVMAccessControlProfileVersionRulesIdentity, Add...

Error output

Resolve-AzError


   HistoryId: 93


Message        : 'resourceGroupName' cannot be null.
StackTrace     :    at Microsoft.Azure.Management.Compute.GalleriesOperations.<GetWithHttpMessagesAsync>d__11.MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                    at Microsoft.Azure.Management.Compute.GalleriesOperationsExtensions.<GetAsync>d__8.MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                    at Microsoft.Azure.Management.Compute.GalleriesOperationsExtensions.Get(IGalleriesOperations operations, String resourceGroupName, String galleryName, String select, 
                 String expand)
                    at Microsoft.Azure.Commands.Compute.Automation.UpdateAzureRmGallery.<ExecuteCmdlet>b__0_0()
                    at Microsoft.Azure.Commands.Compute.ComputeClientBaseCmdlet.ExecuteClientAction(Action action)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Microsoft.Rest.ValidationException
InvocationInfo : {Update-AzGallery}
Line           : Update-AzGallery -InputObject $galleryWithSharingProfile -Share -Tenant $($tenantIdsToAdd -join ',')
                 
Position       : At Q:\src\Compute-ART-1PVMAppGallery\.pipelines\scripts\Ensure-GalleryExists.ps1:119 char:1
                 + Update-AzGallery -InputObject $galleryWithSharingProfile -Share -Tena ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 93

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue requires a change to an existing behavior in the product in order to be resolved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions