Connecting to Cloud Services

Visual Studio Blog

Modern applications often rely on services for analytics, data storage and retrieval, and customer information. It’s increasingly common to see applications that blend together services such as Salesforce with Azure Storage and a couple of analytics services such as Application Insights or Flurry. While these services provide usable REST APIs and client libraries, connecting to them remains a manual process.

Visual Studio 2013 added a Connected Services dialog that started to automate this manual process and in Visual Studio 2015 Preview, we’re going further: we’ve added support for more services such as Azure Storage and Salesforce in addition to existing support for Azure Mobile Services and Office 365 APIs.

If you’ve tried to add a service to your application manually, you’ve probably experienced a workflow that involves adding NuGet, Bower, or NPM packages, trips to an online portal to retrieve connection strings, a (perhaps futile) search for relevant documentation to explain further details to set the service up, and possibly a lesson in OAuth. The Connected Services experience blends together Getting Started guidance, with a wizard-based approach for finding relevant services, getting the right connection libraries, and configuring the services.

This blog post gives an overview of the experience. To get more details, take a look at our getting started documentation for Connected Services and this Channel 9 video on Connected Services.

Walking Through an Example

Once you’ve installed Visual Studio 2015, to view a list of services available for your project, right-click on the References node in Solution Explorer and choose Add Connected Service.

Add Connected Services from References node in Solution Explorer

In the service selection page, select the service you want to consume. Let’s take a look at each of the options from this dialog: Azure Storage, Azure Mobile Services, Office 365, and Salesforce.

Add Connected Services dialog

Azure Storage

You can use the Add Connected Service dialog to connect to Azure Storage from ASP.NET Web projects, ASP.NET 5 projects, Cloud Service Web and Worker role projects, and .NET Mobile Service projects. The dialog will automatically retrieve all configuration information and add it your project so that you don’t have to leave Visual Studio and look for connection strings on the Portal. It also gives you getting started guidance that highlights the next steps for using Azure Storage such as uploading a blob to a container or inserting messages into a queue, reducing the need for you to search online.

Connect to Azure Storage from Add Connected Services dialog

Azure Mobile Services

Today’s data-driven mobile apps often have three basic service needs: data storage, authentication, and push notifications. You can use Azure Mobile Services to fulfill all those requirements with built-in support for SQL Azure, authentication support for Azure AD, Facebook, Google, Twitter, and Microsoft accounts, and push notifications to all major platforms using Azure Notification Hubs. You can connect any .NET or JavaScript Windows Store and Phone app as well as cross-platform Cordova apps to Mobile Services using the Add Connected Service dialog.

Without ever having to leave Visual Studio, you can quickly connect to an existing mobile service or provision a new one with either a JavaScript or a .NET backend. The Add Connected Service dialog will add Mobile Service references using the Mobile Services NuGet package and connection strings to your Mobile Service. It will also provide you getting started guidance on storing and retrieving data so that you’re immediately ready to start using your Mobile Service.

Use existing Azure Mobile Services or create new ones from Add Connected Services dialog

Azure Storage and Azure Mobile services integrate with the new account manager in Visual Studio, which lets you access Azure resources through the same account you’ve used to sign in to the IDE. The new account picker also makes it possible to switch between resources administered from different user accounts. See Ji Eun’s post to learn about other improvements in Visual Studio when working with multiple accounts.

Office 365 APIs

Many companies are deploying Office 365. More than just a suite of office productivity tools, Office 365 includes services that enable you to build applications centered on employees’ Mail, Calendar, Contacts, and Files. The Office 365 integration in VS enables you to sign in to your Office 365 account, register an application, choose an appropriate service for consumption, and apply required permissions.

Office 365 APIs can be added to a wide variety of projects such as WPF desktop applications, ASP.NET Web applications, Store and Phone apps, and finally cross-platform applications built with Apache Cordova or Xamarin. The Add Connected Service dialog will add client libraries from NuGet for the selected service and give you sample code that you can copy and paste into your projects. Check out our documentation to learn more about building apps for Office.

Learn about Office 365 APIs via Add Connected service dialog

Salesforce

We designed the Add Connected Services dialog so you can use it with all sorts of cloud services, including third party services such as Salesforce. You can use the Add Connected Services dialog to connect your ASP.NET Web projects for authentication and consumption of data on Salesforce or a console app for headless scheduled jobs. The Salesforce Add Connected Services wizard will configure your application to consume Salesforce REST APIs, add the Salesforce .NET SDK NuGet package, configure a Salesforce Connected App oAuth endpoint, and provide detailed Getting Started guidance.

Configure Salesforce for .NET from Add Connected Service dialog

Active Directory

Adding Active Directory support to your application manually is fairly involved. Using the Azure Active Directory Authentication wizard, you can quickly add Single Sign-On (SSO) for ASP.NET MVC applications or AD authentication in Web API services. To use the wizard, right click on your project in Solution Explorer and choose the Configure Azure AD Authentication option.

Configure Azure Active Directory Authentication by right clicking on project

For Single Sign On, the wizard will inject startup code into your project that requests users to log in before accessing the site. With AD Authentication on Web API projects, all controllers in your project are adorned with an Authorize attribute thereby restricting access only to authorized users. In both cases, the wizard will add identity related NuGet packages, provision an AD app on your behalf in your directory and modify your web.config or app.config with appropriate credentials.

Configure Azure Active Directory Authentication dialog

We’d love to hear any feedback you have about the Add Connected Service experience. To leave us feedback, you can comment on this post, leave us feedback on UserVoice, or (in Visual Studio) simply click on the Send a Smile icon.

And if you’re interested in plugging into the Add Connected Service dialog with tooling for your service, please fill out this survey.

image Merwan Hade, Program Manager II, Visual Studio Cloud Platform Tools

Merwan is a Program Manager on the Azure Tools team in Visual Studio. He has worked on a number of tooling features, all designed to make it easier for developers to build and debug applications that use cloud services.

0 comments

Discussion is closed.

Feedback usabilla icon