question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ACR]: Generate credential for token fails if token name contains a dash (`-`)

See original GitHub issue

Describe the bug

Generating credential fails if the underlying token name contains a dash (-):

acrName=youracrname
rgName=yourrgname

az acr token credential generate -n sample-token -r $acrName -g $rgName --expiration-in-days 90 --password1

However, if you change the name of the token to SampleToken or sampletoken, everything works as expected.

To Reproduce

Execute the following commands:

acrName=test1234
rgName=rg-1234
az acr scope-map create -n scope-read-everything -r $acrName -g $rgName --repository content/read metadata/read
az acr token create -n sample-token -r $acrName -g $rgName --no-passwords true --scope-map scope-read-everything
az acr token credential generate -n sample-token -r $acrName -g $rgName --expiration-in-days 90 --password1

Last command will fail with:

(ResourceNotFound) The resource smaple-token could not be found.
Code: ResourceNotFound
Message: The resource smaple-token could not be found.

Expected behavior

Credential should be generated.

Environment summary

macOS-12.0.1-x86_64-i386-64bit, Darwin 21.1.0
Python 3.9.9
Installer: PIP

azure-cli 2.30.0

Extensions:
k8sconfiguration 0.2.1
connectedk8s 1.1.3
log-analytics-solution 0.1.1
k8s-extension 0.2.1
aks-preview 0.5.42
resource-graph 1.1.0
containerapp 0.2.0
application-insights 0.1.13
account 0.2.1
connectedmachine 0.3.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ThorstenHanscommented, Dec 14, 2021

@gildardogmsft you were right. I had a typo locally too. My bad!

Sorry, and thanks for pointing me to this one.

0reactions
ThorstenHanscommented, Dec 5, 2021

Yeah the typo was just here in the issue, I can re-verify this evening CEST

https://thorsten-hans.com


From: gildardogmsft @.> Sent: Saturday, December 4, 2021 12:04:14 AM To: Azure/azure-cli @.> Cc: Thorsten Hans @.>; Mention @.> Subject: Re: [Azure/azure-cli] [ACR]: Generate credential for token fails if token name contains a dash (-) (Issue #20538)

Hi @ThorstenHanshttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FThorstenHans&data=04|01||eab62a0468d64483f03008d9b6b139e7|84df9e7fe9f640afb435aaaaaaaaaaaa|1|0|637741694559863243|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000&sdata=1FFdkygYz%2B1ERHLYtbQJwhxBaZ1kQq37JC3oea9aNsc%3D&reserved=0 it seems that there was a typo in your command, based out of the output The resource smaple-token could not be found.

Perhaps the smaple-token should be replaced by sample-token?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-cli%2Fissues%2F20538%23issuecomment-985899535&data=04|01||eab62a0468d64483f03008d9b6b139e7|84df9e7fe9f640afb435aaaaaaaaaaaa|1|0|637741694559863243|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000&sdata=mrP8XutWm0oK4xoDSjn5AnNJW6y3RA35P7jIHNw0iM4%3D&reserved=0, or unsubscribehttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAACXL7E5C7SXN7GDLWO73R3UPFEG5ANCNFSM5I667E3A&data=04|01||eab62a0468d64483f03008d9b6b139e7|84df9e7fe9f640afb435aaaaaaaaaaaa|1|0|637741694559873201|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000&sdata=y7NcQMq1T95K3FwW07v%2BgB3VCugfdh5rTbCX8WxuMV0%3D&reserved=0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

az acr token credential - Microsoft Learn
Generate or replace one or both passwords of a token for an Azure Container Registry. For using token and password to access a...
Read more >
How to sign in kubernetes dashboard? - Stack Overflow
Supported from release 1.6. Has the highest priority. If present, login view will not be shown. Bearer Token that can be used on...
Read more >
OpenID Connect & OAuth 2.0 API - Okta Developer
An opaque value that can be used to redeem tokens from the token endpoint. code is returned if the response_type includes code ....
Read more >
Electronic Authentication Guideline
Tokens (typically a cryptographic key or password) for authentication. (covered in Section 6),. • Token and credential management mechanisms ...
Read more >
Dynatrace API - Tokens and authentication
Name API value Description Ingest OpenTelemetry traces openTelemetryTrace.ingest Allows to ingest OpenTelemetry tr... Read settings settings.read Grants access to GET requests of... Tenant token rotation tenantTokenRotation.write...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found