Skip to content

Commit e24a9cd

Browse files
NickcandyVeryEarly
andauthored
fix bug of get-azresourcegroup (#21337)
* fix bug of get-azresourcegroup * add change log * Update ChangeLog.md * revise code to pass test --------- Co-authored-by: Yabo Hu <[email protected]>
1 parent 2f4bc72 commit e24a9cd

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Resources/ResourceManager/SdkClient/ResourceManagerSdkClient.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,11 @@ public virtual List<PSResourceGroup> FilterResourceGroups(string name, Hashtable
909909
{
910910
try
911911
{
912-
result.Add(ResourceManagementClient.ResourceGroups.Get(name).ToPSResourceGroup());
912+
PSResourceGroup resourceGroup = ResourceManagementClient.ResourceGroups.Get(name).ToPSResourceGroup();
913+
if (string.IsNullOrEmpty(location) || resourceGroup.Location.EqualsAsLocation(location))
914+
{
915+
result.Add(resourceGroup);
916+
}
913917
}
914918
catch (CloudException)
915919
{

src/Resources/Resources/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
## Upcoming Release
2222
* Fixed an issue when running the `New-AzManagementGroup` command where it tried to cast an async operation as a Management Group. [#21000]
23+
* Fixed an issue when running `Get-AzResourceGroup -Name 'some_name'`, it ignores '-Location' if specified[#21225]
2324

2425
## Version 6.5.3
2526
* Updated behavior of Get-AzPolicyDefinition which previously returned all definitions when -Id was provided with a nonexistent policy definition id. Fixed to correctly throw a 404 exception in this case.

0 commit comments

Comments
 (0)