Adding Azure storage by using Visual Studio Connected Services

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

  1. Open your project in Visual Studio.

  2. In Solution Explorer, right-click the Connected Services node, and from the context menu, select Add Connected Service.

    Add Azure connected service

  3. In the Connected Services page, select Cloud Storage with Azure Storage.

    Add Azure Storage

  4. In the Azure Storage dialog, select an existing storage account, and select Add.

    If you need to create a storage account, go to the next step. Otherwise, skip to step 6.

    Add existing storage account to project

  5. To create a storage account:

    1. Select Create a New Storage Account at the bottom of the dialog.

    2. Fill out the Create Storage Account dialog, and select Create.

      New Azure storage account

    3. 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 Add.

  6. The storage connected service appears under the Service References node of your project.

  1. Open your project in Visual Studio.

  2. In Solution Explorer, right-click the Connected Services node, and, from the context menu, select Add Connected Service.

    Add Azure connected service

  3. In the Connected Services tab, select the + icon for Service Dependencies.

    Add Service Dependency

  4. In the Add Dependency page, select Azure Storage.

    Add 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.

  5. 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.

    Add existing storage account to project

  6. To create a storage account:

    1. Select Create a storage account at the bottom of the dialog.

    2. Fill out the Azure Storage: Create new dialog, and select Create.

      New Azure storage account

    3. 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.

  7. Enter a connection string name, and choose whether you want the connection string stored in a local secrets file, or in Azure Key Vault.

    Specify connection string

  8. 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.

    Summary of changes

  9. The storage connected service appears under the Service References node of your project.

See also