azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Get-AzureRmResource : Parameter set cannot be resolved using the specified named parameters.

Open abhishekanand opened this issue 10 years ago • 29 comments

AzureRM version 1.5.1 Get resources by resource group does not work

PS C:\Users\user> Get-AzureRmResourceGroup ResourceGroupName : FTASRVaultRG Location : eastus ProvisioningState : Succeeded Tags : ResourceId : /subscriptions/6b6a59a6-e367-4913-bea7-34b6862095bf/resourceGroups/FTASRVaultRG

ResourceGroupName : mygroup2 Location : centralus ProvisioningState : Succeeded Tags : ResourceId : /subscriptions/6b6a59a6-e367-4913-bea7-34b6862095bf/resourceGroups/mygroup2

PS C:\Users\user> Get-AzureRmResource -ResourceGroupName mygroup2 Get-AzureRmResource : Parameter set cannot be resolved using the specified named parameters. At line:1 char:1

  • Get-AzureRmResource -ResourceGroupName mygroup2
  • - CategoryInfo          : InvalidArgument: (:) [Get-AzureRmResource], ParameterBindingException
    - FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.GetAzureResourceCmdlet
    

abhishekanand avatar Jul 13 '16 18:07 abhishekanand

@vivsriaus can you take a look?

markcowl avatar Jul 14 '16 00:07 markcowl

@abhishekanand this is not an issue with the cmdlet, this is by design. That said, we're currently evaluating options to list resources under a resource group, and to add support for this in one of our ARM cmdlets.

In the meantime, please use Find-AzureRmResource -ResourceGroupNameContains "myGroup" as a workaround. Cc/ @ravbhatnagar

vivsriaus avatar Jul 14 '16 04:07 vivsriaus

#2307 , #2093

ravbhatnagar avatar Jul 14 '16 20:07 ravbhatnagar

ResourceGroupName is a named parameter of Get-AzureRmResource and yet even when a Resource Group Name is explicitly given, it still results in:

` Get-AzureRmResource : Parameter set cannot be resolved using the specified named parameters. At line:1 char:1

  • Get-AzureRmResource -ResourceGroupName 'RESOURCE_GROUP_NAME'
  • - CategoryInfo          : InvalidArgument: (:) [Get-AzureRmResource], ParameterBindingException
    - FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation. 
      GetAzureResourceCmdlet
      `
    
    

Also, using the suggested technique of 'Find-AzureResource -ResourceNameContains' is not adequate. I don't want the resource group that CONTAINS that name, I want THAT, specific, resource group...

What is the ETA to resolve this bug?

raycrawford avatar Aug 30 '16 22:08 raycrawford

This will be fixed in December release of PS. Exact name matches will be supported in Find cmdlet.

ravbhatnagar avatar Nov 10 '16 08:11 ravbhatnagar

Exact name matches are now supported in the Find-AzureRmResource cmdlet through ResourceGroupNameEquals and ResourceNameEquals.

ravbhatnagar avatar Jan 06 '17 01:01 ravbhatnagar

This is still an issue, the cmdlet still throws this error. I don't believe this is by design, more it may be by design because of a bug. The documentation in example # 2 clearly shows that this should be a viable use. Get-AzureRmResource documentation

johnwc avatar Jul 18 '18 17:07 johnwc

Agree, I cannot get any of the examples in the Get-AzureRmResource documentation to do anything but throw error. For example:

Get-AzureRmResource -ResourceType Microsoft.Compute/virtualMachines | ft

Get-AzureRmResource : Parameter set cannot be resolved using the specified named parameters.

I have entered example #6 from the documentation exactly. None of the other examples work, either. If this is by design, please fix the documentation and show us how we are supposed to query resources. Note, the base command without parameters works, and lists all resources.

FWIW: the cmdlet window shows that "ByResourceNameAndType" has no required params, and indeed if you supply just name and type, it will fail for not knowing the group. If you use "ByNameGroupAndType" and supply all 3 values, the command works.

jfinnecy avatar Jul 27 '18 23:07 jfinnecy

I will second that one from johnwc

dapostoladeloitte avatar Jul 28 '18 00:07 dapostoladeloitte

Agree. Re-open.

gcormier avatar Aug 24 '18 17:08 gcormier

@vivsriaus seems people are still having issues. Can you reopen and take a look?

mimckitt avatar Sep 04 '18 19:09 mimckitt

+1 for re-opening

AuroraBrignola avatar Sep 06 '18 15:09 AuroraBrignola

reopening, will investigate and get back. @Tiano2017 FYI.

ravbhatnagar avatar Sep 10 '18 18:09 ravbhatnagar

I have same issue, got around it by using oDataQuery parameter.

Get-AzureRmResource -oDataQuery "`$filter=resourcegroup eq 'myrg'"

ghost avatar Sep 13 '18 17:09 ghost

@COMikaze appreciate the workaround, but this issue is about getting it fixed and not finding a work around.

johnwc avatar Sep 15 '18 16:09 johnwc

Yup, having the same problem when I use Get-AzureRmResource -ResourceType Microsoft.Web/sites

Please fix.

hamsome avatar Sep 18 '18 23:09 hamsome

same.. but with $keyVault = Get-AzureRmKeyVault -VaultName $VaultName -ResourceGroupName $KeyVaultResourceGroupName -Location $region

Get-AzureRmKeyVault : Parameter set cannot be resolved using the specified named parameters. At line:1 char:13

  • $keyVault = Get-AzureRmKeyVault -VaultName $VaultName -ResourceGroupN ...

tr1al3x avatar Oct 15 '18 20:10 tr1al3x

Shouldn't this be a bigger issue since Find-AzureRmResource is removed now? I am not sure how this thread isn't blown up. Getting resources in a resource group seems like a basic.

cohowap avatar Oct 22 '18 20:10 cohowap

Receiving this same error when attempting to find all SQL Azure Databases.

Get-AzureRmResource -ResourceType 'Microsoft.Sql/servers/databases'

Running version 6.11.0 of the Azure PowerShell module.

theMickster avatar Oct 26 '18 21:10 theMickster

Facing this error while executing in runbook. Please help

Get-AzureRmKeyVault : Parameter set cannot be resolved using the specified named parameters. At line:13 char:10

  • $value = Get-AzureRmKeyVault `
  •      ~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (:) [Get-AzureRmKeyVault], ParameterBindingException
    • FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Azure.Commands.KeyVault.GetAzureKeyVault

nirmalpavan avatar Nov 05 '18 03:11 nirmalpavan