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

AKV10032: Invalid issuer error for listing of key vault secrets from nondefault tenant subscription

Open t3mi opened this issue 6 years ago • 33 comments

Describe the bug

Command Name az keyvault secret list

Errors:

AKV10032: Invalid issuer. Expected one of https://sts.windows.net/<nondefault tenant>/, found https://sts.windows.net/<default tenant>/.

To Reproduce:

Steps to reproduce the behavior.

  • az login // login with one tenant
  • az login // login with second tenant
  • az account list // verify multiple subscriptions exist with different tenants
  • az keyvault secret list --subscription <subscription from nondefault tenant> --vault-name {} --query '[].id'

Expected Behavior

Secret ids are printed.

Environment Summary

Windows-10-10.0.18362-SP0
Python 3.6.6
Shell: powershell.exe

azure-cli 2.0.80

Additional Context

  • az account list
[
  {
    "cloudName": "AzureCloud",
    "id": "<default subscription>",
    "isDefault": true,
    "name": "Visual Studio Enterprise with MSDN",
    "state": "Enabled",
    "tenantId": "<default tenant>",
    "user": {
      "name": "<email>",
      "type": "user"
    }
  },
  {
    "cloudName": "AzureCloud",
    "id": "<subscription from nondefault tenant>",
    "isDefault": false,
    "name": "Visual Studio Enterprise",
    "state": "Enabled",
    "tenantId": "<nondefault tenant>",
    "user": {
      "name": "<email>",
      "type": "user"
    }
  }
]

t3mi avatar Jan 15 '20 19:01 t3mi

@bim-msft, please help take a look, thanks.

jsntcy avatar Jan 16 '20 04:01 jsntcy

Any updates on this?

t3mi avatar Feb 07 '20 18:02 t3mi

@t3mi This is a cross-tenants issue, I believe it's similar with #7607 , the parameter --subscription seems broken now as we are facing some complicated cross-tenants problems, please avoid using this parameter as a workaround. For more info, please refer to: #7902

bim-msft avatar Feb 08 '20 05:02 bim-msft

Our deployment is blocked due to the same error code

2020-03-12T19:23:08.4378500Z Operation Info: 2020-03-12T19:23:08.4386094Z Start Time: 03/12/2020 19:22:40 2020-03-12T19:23:08.4392880Z End Time: 03/12/2020 19:22:40 2020-03-12T19:23:08.4439932Z Error Reason: Error in 'payloadProperties' for extension 'Microsoft.Azure.Portal.HostingService/DeployPortalExtension'. Error Message: Rollout action failed. Please check the help link for more information. 2020-03-12T19:23:08.4442589Z AKV10032: Invalid issuer. Expected one of ....

jjnwu avatar Mar 13 '20 18:03 jjnwu

the scenario in keyvault requires global --subscription works well for cross-tenant scenarios firstly.

yungezz avatar Apr 10 '20 10:04 yungezz

@yungezz please mark this as a bug There is a key and it's not working properly, it's not a feature request.

t3mi avatar Apr 22 '20 07:04 t3mi

I have experienced the same bug with secret set with the subscription flag

bendubuisson avatar Apr 28 '20 02:04 bendubuisson

That being said, if you set the sub as default just before, it works, so:

az account set --subscription {SubID}
az keyvault secret list --vault-name myVault

bendubuisson avatar Apr 28 '20 02:04 bendubuisson

az keyvault storage list --vault-name <Vault Name> doesn't work. Neither with --subscription <sub> nor without --subscription works.

Azure cli version: 2.0.75

juniwang avatar May 14 '20 09:05 juniwang

@t3mi This is a cross-tenants issue, I believe it's similar with #7607 , the parameter --subscription seems broken now as we are facing some complicated cross-tenants problems, please avoid using this parameter as a workaround. For more info, please refer to: #7902

any update? we are also running into this issue while attempting cross tenant key access. tried both with and without subscription parameter.

dosani avatar Sep 03 '20 19:09 dosani

I am receiving this error even on the default subscription.

az account show
{
  "environmentName": "AzureCloud",
  "homeTenantId": "REDACTED",
  "id": "REDACTED",
  "isDefault": true,
  "managedByTenants": [
    {
      "tenantId": "REDACTED"
    }
  ],
  "name": "Enterprise Dev/Test",
  "state": "Enabled",
  "tenantId": "REDACTED",
  "user": {
    "name": "REDACTED",
    "type": "user"
  }
}
az keyvault secret list --vault-name keyvault-test
AKV10032: Invalid issuer. Expected one of https://sts.windows.net/ab8cb611-0add-432b-9975-ae87e1ebe6f7/, https://sts.windows.net/f8cdef31-a31e-4b4a-93e4-5f571e91255a/, https://sts.windows.net/e2d54eb5-3869-4f70-8578-dee5fc7331f4/, found https://sts.windows.net/71fdf23f-162c-4ca1-a83b-7a68e8b5ea85/.

The keyvault-test keyvault is in the default subscription listed above. I am certain that this used to work.

az version
{
  "azure-cli": "2.11.1",
  "azure-cli-core": "2.11.1",
  "azure-cli-telemetry": "1.0.5",
  "extensions": {}
}

MikePennington avatar Sep 22 '20 17:09 MikePennington

The day a bug becomes a feature request. (I can confirm this bug, it is still on-going)

c0dezer019 avatar Dec 12 '20 01:12 c0dezer019

For the people running into this even when the subscription ID is set correctly, you should check the --vault-name for typos. You may be trying to talk to the wrong Key Vault (that's what happened in my case).

lvisterin avatar Feb 24 '21 15:02 lvisterin

hi @houk-ms could you have a look? thanks

yungezz avatar Apr 06 '21 06:04 yungezz

I can confirm this is still a concern and the work-around of reasserting subscription before each 'az keyvault' call mitigates it. Below is the function I call before each 'az keyvault' command:

function akvBugFIX 
{ 
    # addresses an Azure Keyvault bug - https://github.com/Azure/azure-cli/issues/11871 #
    az account set --subscription ${subscriptionID} --output none
    ###################################
}

inverted360 avatar Apr 08 '21 18:04 inverted360

Is this still active? We have the same problem. AKV10032. Invalid Issuer,

  • made sure the user has permission to check key-vault
  • logged in to the correct subscription

weird thing is that we tried another user with the same code and subscription which worked well.

Which is even more wierd is that it's no problem with using az commands in powershell. So i guess the problem is in visual studio if you used that?

tobbin2 avatar Apr 15 '21 09:04 tobbin2

I don't get this error in powershell with AZ CLI (e.g. listing the secrets from the keyvault). I get this error running code from Visual Studio: .AddAzureKeyVault(keyVaultUri, new DefaultAzureCredential(true)) (browser window popping up) and the same error with: .AddAzureKeyVault(keyVaultUri, new SharedTokenCacheCredential("[email protected]"))

I have logged in and out in VS (2019), the Azure Service Authentication under Tools > Options looks good

It's working when using the old nuget (Microsoft.Extensions.Configuration.AzureKeyVault 3.1.14) - without supplying any credentials.

Maybe I should add that I have multiple accounts on Azure Portal, but only logged in to the one referred to above I also have multiple subscriptions

mira-mayhem avatar Apr 17 '21 09:04 mira-mayhem

This happens to me today. Pretty much blocking our deployment

thuannguy avatar Apr 27 '21 09:04 thuannguy

Can confirm this also happens with InteractiveBrowserCredential. Trying to access a keyvault with my work account which is permitted in azure to access the keyvault. Pretty sure the keyvault I am trying to access resides in a non-default azure subscription.

MaDOS avatar Apr 28 '21 13:04 MaDOS

Just ran into the same issue as well...why would they allow us to transfer a vault if it is essentially useless outside of it's "birth" tenant??

Rob97 avatar Apr 29 '21 09:04 Rob97