Adding Azure storage by using Visual Studio Connected Services
Applies to: Visual Studio
Visual Studio for Mac
Visual Studio Code
With Visual Studio, you can connect any of the following to Azure Storage by using the Connected Services feature:
- .NET Framework console app
- ASP.NET MVC (.NET Framework)
- ASP.NET Core
- .NET Core (including console app, WPF, Windows Forms, class library)
- .NET Core Worker Role
- Azure Functions
- Universal Windows Platform App
- Xamarin
- Cordova
The connected service functionality adds all the needed references and connection code to your project, and modifies your configuration files appropriately.
Note
This topic applies to Visual Studio on Windows. For Visual Studio for Mac, see Connected services in Visual Studio for Mac.
Prerequisites
- Visual Studio with the Azure workload installed.
- A project of one of the supported types
Connect to Azure Storage using Connected Services
Open your project in Visual Studio.
In Solution Explorer, right-click the Connected Services node, and, from the context menu, select Add Connected Service.
In the Connected Services tab, select the + icon for Service Dependencies.
In the Add Dependency page, select Azure Storage.
If you aren't signed in already, sign into your Azure account. If you don't have an Azure account, you can sign up for a free trial.
In the Configure Azure Storage screen, select an existing storage account, and select Next.
If you need to create a storage account, go to the next step. Otherwise, skip to step 6.
To create a storage account:
Select Create a storage account at the bottom of the dialog.
Fill out the Azure Storage: Create new dialog, and select Create.
When the Azure Storage dialog is displayed, the new storage account appears in the list. Select the new storage account in the list, and select Next.
Enter a connection string name, and choose whether you want the connection string stored in a local secrets file, or in Azure Key Vault.
The Summary of changes screen shows all the modifications that will be made to your project if you complete the process. If the changes look OK, choose Finish.
The storage connected service appears under the Connected Services node of your project.
Open your project in Visual Studio.
Press Ctrl+Q (or use the Search button in the Visual Studio IDE to the right of the main menu bar).
In Feature search, enter
Azure Storage
, and choose Azure Storage - Project > Connected Services > Add > Azure Storage.In the Connect to dependency page, select Azure Storage, and then click Next.
If you aren't signed in already, sign into your Azure account. If you don't have an Azure account, you can sign up for a free trial.
In the Connect to Azure Storage screen, select an existing storage account, and select Next.
If you need to create a storage account, go to the next step. Otherwise, skip to the following step.
To create a storage account:
Select Create new by the green plus sign.
Fill out the Azure Storage: Create new dialog, and select Create.
When the Azure Storage dialog is displayed, the new storage account appears in the list. Select the new storage account in the list, and select Next.
Enter a connection string name, and choose whether you want the connection string stored in a local secrets file, or in Azure Key Vault.
The Summary of changes screen shows all the modifications that will be made to your project if you complete the process. If the changes look OK, choose Finish.
The storage connected service appears under the Connected Services node of your project.
Next steps
Azure Storage supports blobs and queues, as well as other features.
To learn about working with blobs, you can continue with the quickstart for blob storage, but instead of starting at the beginning, you can start at Azure blobs quickstart (.NET) - Code examples.
To learn about working with queues, start at Azure queues quickstart (.NET) - Code examples.
See also
Feedback
Submit and view feedback for