Azure / Azure/azure-powershell
Update-AzGallery -InputObject <PSGallery> -Share -Tenant<String[]> cannot infer resource group information from input object
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
### Description
Update-AzGallery -InputObject \ -Share -Tenant
fails with error "Update-AzGallery : 'resourceGroupName' cannot be null."
### Issue script & Debug output
```PowerShell
$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
```PowerShell
$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
```PowerShell
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
```PowerShell
Resolve-AzError
HistoryId: 93
Message : 'resourceGroupName' cannot be null.
StackTrace : at Microsoft.Azure.Management.Compute.GalleriesOperations.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.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.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
```
Contributor guide
Research direction
Start with the reported Update-AzGallery entry point and reproduce the failure using the Ensure-GalleryExists.ps1 command sequence at line 119. Trace how the InputObject is handled for the -Share operation, then verify that sharing completes without the resourceGroupName validation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100