azure-dev: `azd` extension <> Azure Tools don't share credentials

We need to figure out how we can leverage the same token/credentials for the azd extension in VS Code as the Azure Tools extension pack.

Right now, this inconsistency means that I can open a project/start a project in VS Code that leverages my work subscription via azd but Azure Tools is logged into my personal subscription. As such, I cannot “Show resource group” for my current project until I log out of my personal sub and reauthenticate with my work sub via the Azure Tools extension pack.

image

### Tasks
- [x] Define HTTP Based Prototcol to shuttle GetToken requests across processes
- [x] Implement client for protocol in `azd`
- [x] Implement server for protocol in VS Code extension
- [ ] Work through Multi-Tenant Auth Story
- [ ] Make `azd login` do "the right thing" when in integrated auth mode.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 23 (20 by maintainers)

Commits related to this issue

Most upvoted comments

@bwateratmsft Following the steps you mentioned, it works.

The exact steps are a little different. The extension launches azd processes with a nonce that gives access to the token server. So only processes launched by the extension can benefit from the shared authentication.

  1. Enable the setting azure-dev.auth.useIntegratedAuth: image
  2. Run azd auth logout in the terminal to ensure AZD is not signed in.
  3. Run the VSCode command “Azure Developer CLI (azd): Package, Provision and Deploy (up)”
  4. You may be prompted to allow the AZD extension to sign in with Microsoft. This should be necessary only once on any given machine. Click “Allow” and follow through with the sign in. image
  5. The extension will run the azd up command, this should succeed. It has obtained auth information from the extension.

@v-xuto can we test this and make sure it works?

Currently the feature is toggled off. Can be enabled from vscode azd extension settings, I guess @bwateratmsft? Refer PR for more details https://github.com/Azure/azure-dev/pull/2541

cc: @gkulin for capturing it in docs FAQ may be?