Skip to content

Get-AzResourceGroup returns false positive #15612

Open
@florinangelescu

Description

@florinangelescu

Description

When using unconventional names for the resource group value (URLs), the cmdlet doesn't return anything as result.

Steps to reproduce

Resource group RG1 exists.
Resource group RG2 does not exists.

Get-AzResourceGroup -Name "RG1"

Returns the details of the resource group.

Get-AzResourceGroup -Name "RG2"

Fails and says the provided resource group does not exist.

Get-AzResourceGroup -Name "https://RG1?default"

Doesn't return anything, but it also doesn't fail.
In an automation we have, we are validating the resource group name and you can imagine this leads to false positive results (when the cmdlet doesn't fail).
Also, logically, this doesn't have any sense. It should either return the results of the resource group details or fail. How can it be that it has a 3rd option?

Environment data

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

Module versions

ModuleType Version    Name                                ExportedCommands                      
---------- -------    ----                                ----------------                      
Script     2.5.2      Az.Accounts                         {Add-AzEnvironment, Clear-AzContext...
Script     4.3.0      Az.Resources                        {Add-AzADGroupMember, Export-AzReso...
Script     0.0        cdsa.azure                          {Add-cdsaAzureNetworkSecurityGroupR...
Script     0.0        cdsa.devops                         {Copy-cdsaAzureDevOpsBaseAppModifie...
Script     1.0.0.0    ISE                                 {Get-IseSnippet, Import-IseSnippet,...
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpo...
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {ConvertFrom-SecureString, ConvertT...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variab...
Manifest   3.0.0.0    Microsoft.WSMan.Management          {Connect-WSMan, Disable-WSManCredSS...

Debug output


Error output


Metadata

Metadata

Assignees

No one assigned

    Labels

    ARM - CoreService AttentionThis issue is responsible by Azure service team.customer-reportedquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions