How do I sign in to Azure from VS Code?

alma eyre 11 Reputation points
2022-01-16T09:44:40.657+00:00

"Selected user account does not exist in tenant 'Microsoft Learn Sandbox' and cannot access the application 'aebc6443-996d-45c2-90f0-388ff96faa56' in that tenant. The account needs to be added as an external user in the tenant first. Please use a different account."

This is the error that I get when I click on "Sign in to Azure" from the Azure Functions extension in VS Code. This is not a step that is covered in the documentation (even in the pre-requisites) for creating an Azure Function. How do I resolve this? It is for all accounts, and it appears to be a missing step in the documentation. Creating a new Azure account does not solve this issue.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,936 questions
{count} votes

2 answers

Sort by: Most helpful
  1. MayankBargali-MSFT 70,941 Reputation points Moderator
    2022-01-17T08:57:21.15+00:00

    @alma eyre Apology for the inconvenience with this issue. I have followed the document and Prerequisites but couldn't reproduce the issue at my end.
    As per the error, it is coming from the azure sandbox account and the user for which the sandbox account was activated doesn't exist. The sandbox account is activated for a few hours (4 hr) and the error could be observed if you perform any operation on the sandbox subscription post the sandbox account is deactivated.

    Selected user account does not exist in tenant 'Microsoft Learn Sandbox' and cannot access the application 'aebc6443-996d-45c2-90f0-388ff96faa56' in that tenant. The account needs to be added as an external user in the tenant first. Please use a different account.

    As you have mentioned that you have tried creating the free account still it didn't help. I will suggest you to perform the below steps to sign out from the vs code extension and sign in again with your free trial azure subscription and confirm if you still observe the issue.

    • Go to the Azure portal and sign out (https://portal.azure.com/)
    • Now open Visual Studio and Open the Command Palette (Ctrl + Shift + P) --> search for Azure: Sign Out and click on it. It will signout you from the Visual Studio extension and you can verify the same by Azure extension as you will see the sign in option.
    • Sign in to the Azure portal and your extension should show your subscription (for the testing I have used the sandbox environment that I have activated)

    165546-vscode.gif

    Hope the above helps you to sign in to VS code. If you still facing the issue then please refer to my private comment so I can connect with you offline to resolve the issue.
    Feel free to get back to me if you need any assistance.

    4 people found this answer helpful.

  2. Tasadduq Burney 8,956 Reputation points MVP Volunteer Moderator
    2022-01-16T10:24:07.833+00:00

    Hello,

    Hope you are having a great day!
    Thank you for asking Question!

    As per the error what I can guess is, the VS code is trying to access the application which does not exist in your Learn Sandbox directory.

    Could you try changing your Directory as mentioned below?
    165392-image.png

    Regards,
    Tasadduq Burney

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.