Update README with troubleshooting info#7070
Conversation
Added troubleshooting information regarding azd init
There was a problem hiding this comment.
Pull request overview
Adds a troubleshooting note to the azure.coding-agent extension README to help users resolve errors when running azd coding-agent config by pointing out the need to run azd init first.
Changes:
- Added additional troubleshooting guidance related to running
azd initbefore configuration.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| You might also get this error if you have not run `azd init` first. To fix this, run `azd init` and go through the setup wizard. After this is completed, you should be able to run `azd coding-agent config`. | ||
|
|
There was a problem hiding this comment.
@richardpark-msft , can we make the extension to return this as part of the error? or even make the extension to invoke azd init ?
Looking for a way to shift left this from happening to preventing
There was a problem hiding this comment.
From talking with @bob-okeefe, it sounded like the steps he went through were:
- azd login
- Run the coding-agent extension
- Error back from AZD cred (internally) that says the refresh token is expired
So then he azd init'd and it worked.
Does azd init do something differently from azd login?
There was a problem hiding this comment.
Interesting.
It might make a difference if you were asked to pick a subscription - or if the azd init invoked the azd auth login
Do we have more details about the number 3? I what was trying to use the credential?
Any ideas @weikanglim ? -
But then, @richardpark-msft , there's not expectation from the extension around running azd init first? If not, we should not add this note and instead make this an issue/bug to investigate (try to repro).
There was a problem hiding this comment.
I was always asked to pick a subscription when I ran azd coding-agent config. I would choose my subscription and my repo. However when I got to the MI step and said to create a new MI it always failed. I was only able to resolve this after running azd init.
There was a problem hiding this comment.
BTW, I only figured out that I had to run azd init because when I was using Copilot to troubleshoot this it suggested running azd env set AZURE_SUBSCRIPTION_ID . When I did this I got this error:
ERROR: no project exists; to create a new project, run azd init
After the azure.yml file was created I was able to run azd coding-agent config successfully
There was a problem hiding this comment.
Apparently those errors are coming from when I call into the 'azd' PromptClient/PromptServiceClient:
I was wondering, at first, if perhaps I was messing up some subscription or passing in a bad credential, but this is within 'azd' itself.
There was a problem hiding this comment.
But then, @richardpark-msft , there's not expectation from the extension around running
azd initfirst? If not, we should not add this note and instead make this an issue/bug to investigate (try to repro).
There isn't - I remember us talking about this. I don't use any azd logic to detect or use any project, so it should be safe.
There was a problem hiding this comment.
Do you happen to have subscriptions across multiple tenants? I wonder if doing azd auth login --tenant <tenant-id> would've helped in this case. It's odd you still got an expired token error right after running azd auth login.
There was a problem hiding this comment.
did you ended up running azd env set AZURE_SUBSCRIPTION_ID xxxxxx ?
If yes, that's how it was fixed.
You had to run azd init ... but only to be able to run azd env set ... - to have an azd env where to set the sub-id.
A similar approach is to set AZURE_SUBSCRIPTION_ID as system env var (not at azd's env) and that would also work.
The issue is that azd is trying to use a token for the wrong tenant. When you set the sub-id, azd resolves the right tenant where that sub belongs to.
Even thought the extension is asking for a subscription, azd is not using the response to use that sub/tenant for the following events - instead it is using the credential provider which resolves to use a different token.
We need to make the extension to use the subId selected to re-set the credential provider - I'll see if that can be done (time to chat to the AI ...) - I'll be back to you...
There was a problem hiding this comment.
Confirmed the hypothesis — the extension uses Subscription.TenantId (resource tenant) instead of Subscription.UserTenantId (user access tenant) when creating the AzureDeveloperCLICredential. For multi-tenant/guest users these differ, causing "refresh token expired" errors.
wbreza
left a comment
There was a problem hiding this comment.
📋 Code Review — PR #7070
Thanks for surfacing this user pain point! The troubleshooting note is helpful.
One thing to note: the review thread identified the root cause as a tenant ID mismatch in the extension (using Subscription.TenantId instead of Subscription.UserTenantId). The azd init workaround helps because it sets AZURE_SUBSCRIPTION_ID. Once the underlying bug is fixed, this note may need updating.
Overall Assessment: Approve


Added troubleshooting information regarding azd init