Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
If you are not already signed in with an Azure subscription, you might encounter a dialog like these:
If you have a Visual Studio subscription, you already have an Azure subscription with some credits. Just activate them and sign in to Visual Studio.
Visual Studio also gives you the opportunity to create a new, free Azure account to try things out with.
Visual Studio allows you to sign in with multiple accounts and it let's you work with Azure resources across multiple Azure subscriptions so no need to sign-out of one in order to sign-in with another!
Note
When using the Azure CLI, be aware that the sign-in from the Azure CLI is separate from the sign-in used in Visual Studio, so even if you're signed in to Azure by using az login
on the same machine where you're running Visual Studio, you still need to provide credentials within Visual Studio.
To sign in to Azure from a dialog or wizard screen
Select the Sign In button, and then choose Add an account. You should see options such as Microsoft Work, school, or personal account. This option means Microsoft Entra ID (Microsoft Account).
Next, you see a screen listing Microsoft Accounts. Choose the account that has access to the Azure resources you require. Accounts known to Visual Studio are shown, but you can add another if the account you're looking for is not listed.
Once you choose an account, you might be asked for credentials and two-factor authentication, depending on the security environment on your computer and your account's security settings.
After a successful sign-in, focus returns to the dialog, and you should see your subscription listed in the place where the Sign In box was previously.
To avoid having to sign in when you connect to an Azure service or publish to Azure, you can use Visual Studio's account management features to add your Azure subscription to your Visual Studio accounts. In that case, you are automatically signed in whenever you're using Visual Studio. See Add and switch user accounts to Visual Studio.
Note
If you have a personal and a work (or school) account, that are both owners on the same subscription, you might encounter a situation where the personal account doesn't get the expected role-based permissions on a service dependency, such as a storage account, but the work account does. The indication that this issue is happening is a timeout in the Connected Services summary screen:
Create Azure Resource Connector Service result: Succeeded. resourceid: <resourceid> Error code: MaxWaitingTimeHit. Error message: Max running time hit when operating service connector resource.
To get around this, manually add the required roles for the personal account in the Azure portal.
Filter multiple tenants
If you have multiple tenants, you can filter them, so that you only see the Azure resources relevant to your current work. See Opt out of a specific Microsoft Entra tenant in Visual Studio.
Tokens and chained credentials
Visual Studio 2022 uses security tokens to authenticate to Azure services in most cases. The underlying API used is the
Microsoft Authentication Library (MSAL). On the same machine, you might also use other ways to sign in to Azure, for example, az login
from the Azure CLI, or through Visual Studio Code. These methods of authentication are designed to work together as a set of chained credentials. For example, in cases where a client application uses an API like DefaultAzureCredential to authenticate to Azure on your development machine, there's a well-defined sequence in which credentials in the chain are attempted. For more information, see Credential chains in the Azure Identity Library for .NET.