Azure / Azure/azure-powershell
Get-AzResourceGroup returns false positive
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
## 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.
```powershell
Get-AzResourceGroup -Name "RG1"
```
Returns the details of the resource group.
```powershell
Get-AzResourceGroup -Name "RG2"
```
Fails and says the provided resource group does not exist.
```powershell
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
```powershell
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
```
```
Contributor guide
Research direction
Start by reproducing the three Get-AzResourceGroup -Name cases from the issue with the listed Az.Resources version, then trace the Get-AzResourceGroup entry point and its resource-group name handling. Done means an unconventional name such as https://RG1?default consistently returns the resource group or reports that it does not exist, rather than silently returning nothing.
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
- 58/100