SALES: 1-800-867-1380

Tutorial: Connect ASP.NET application to SQL Server in Azure via Virtual Network

Updated: February 28, 2014

Building applications that utilize both Azure Cloud Services (platform-as-a-service) and Azure Virtual Machines (infrastructure-as-a-service) is an important concept for most organizations. With Azure Virtual Machines, you can migrate your existing server workloads and applications to Azure by deploying and managing virtual machines. With Azure Cloud Services, you can build and run multi-tier applications in Azure by deploying cloud services (also known as hosted services) consisting of web roles and worker roles.

This tutorial demonstrates how to connect an ASP.NET application (a cloud service and a Web role) to a SQL Server in Azure Virtual machine via Azure Virtual Network. When you create a virtual machine in Azure, the portal allows you to set the virtual network settings. For cloud services, you need to use the service configuration files to deploy the cloud service to a specific virtual network in Azure.

In this tutorial, you will learn how to:

Set Up the Development Environment

  1. To follow this tutorial, install Visual Studio to your local computer.

  2. In addition, install the Azure SDK for the .NET Framework.

    • To install the Azure SDK for .NET, click the Azure Downloads link. Choose one of the versions that corresponds to the version of Visual Studio you are using:

      Azure SDK for Visual Studio 2013

      Azure SDK for Visual Studio 2012

    • When you are prompted to run or save VWDOrVs2013AzurePack.2E2.2E2.exe or VWDOrVs11AzurePack.2E2.2E2.exe, click Run.

    • In the Web Platform Installer window, click Install and proceed with the installation.

  3. (Optional) If you want test this tutorial in your local on-premises development environment, make sure to install SQL Server in your local computer as well.

Create an Azure Virtual Network

In this tutorial, our goal is to create a dedicated private virtual network in the cloud. This ensures that the internal IP address (DIP-Directed IP) of your virtual machines will remain persistent and will not change, even when you restart a virtual machine. The following steps demonstrate how to create a new virtual network for your subscription in the Management Portal.

  1. In the left navigation pane, click NETWORKS, and click NEW at the bottom panel. Then, click VIRTUAL NETWORK and CUSTOM CREATE.

  2. In the Virtual Network Details window, type TestVirtualNetwork in the Name box. Select Region. Choose Create a new affinity group. Type TestAffinityGroup in the Affinity Group Name field. Click the next arrow to continue.

    Creating an affinity group allows Azure to keep all of the services that belong to that affinity group as close to each other as possible in one data center. This reduces latency and increases performance, while potentially lowering costs. When you create a virtual network, you can either use an affinity group that you previously created, or you can create a new one. If you use an existing affinity group with your new virtual network, any previously deployed cloud services within that affinity group will automatically be designated to run in a location as close as possible to the other cloud services that you deploy to your new virtual network.

  3. In the DNS Servers and VPN Connectivity dialog window, enter the DNS server name and IP address that you want to use like TestDNSServer and 10.1.0.4. Do not select the checkbox for point-to-site or site to site connectivity. In this tutorial, we are creating a private virtual network in Azure and it is not designed for cross-premises connectivity.

  4. In the Virtual Network Address Spaces dialog window, you can create the private address space for your new virtual network and subnets. Address space must be a private address range, specified in CIDR notation 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16 (as specified by RFC 1918). For Address Space, enter 10.4.0.0 as Starting IP and /16 as CIDR. Note that anything you deploy to the virtual network will get an IP address from this address space. Rename Subnet-1 to FrontEndSubnet with the Starting IP10.4.2.0/24, and then click Add subnet. Click the checkmark on the lower right to create your virtual network.

    You can create multiple subnets within the virtual network address space. Creating subnets give you more control over the addresses that are assigned to the cloud services and over the virtual machines that are deployed to the virtual network. When building complex applications for the Azure platform, we recommend that you setup multiple subnets in the same virtual network, such as a subnet for your Internet Information Services (IIS) virtual machines and another subnet for your SQL Server virtual machines.

    Note that subnet IP addresses cannot overlap within the virtual network.

  5. AzureYou cannot change the DNS Server after the virtual network is deployed. Therefore, it is very important to plan your DNS service carefully. For more information to help with this planning, see Azure Name Resolution Overview.

    After your virtual network has been configured, you can deploy virtual machines or cloud services. For detailed information on how to setup a virtual network, see About Configuring a Virtual Network in the Management Portal topic in the MSDN library. For additional information on Azure Network and its usage scenarios, see Azure Virtual Network and Overview of Azure Virtual Machines in the MSDN library.

Create a Storage Account

In Azure, your databases appear to be stored in the local disk of the virtual machine that the SQL Server instance runs in. In the background, each of those disks is written to an Azure Blob. Azure uses the storage account as a container for your disks. The following steps demonstrate how to create a new storage account in the Management Portal.

  1. After creating your virtual network in the Azure Management Portal, on the left, click STORAGE, and on the left-hand corner of the screen, click +NEW.

  2. Click Data Services, Storage, and then click Quick Create.

  3. Type teststorageaccount4u in the URL box, choose the affinity group that you just created. In Replication, you can select the level of replication that you desire for your storage account. In this tutorial, select Locally Redundant. Then, click CREATE STORAGE ACCOUNT check box.

For more information on Azure storage accounts, see What is a Storage Account.

Configure a SQL Server Virtual Machine in the specified affinity group and the virtual network

The goal of this tutorial is to demonstrate how to connect an ASP.NET application (a Web role) to a SQL Server in Azure Virtual machine via Azure Virtual Network. This section demonstrates how to create and configure a SQL Server virtual machine in the specified affinity group and the virtual network.

  1. On the Azure Management Portal, at the bottom left of the web page, click +NEW, click COMPUTE, and then VIRTUAL MACHINE, and then click FROM GALLERY.

  2. Select a virtual machine image containing SQL Server, and then click the next arrow at the bottom right of the page.

  3. On the Virtual machine configuration page, provide the following information:

    • If multiple versions of the image are available, in Version Release Date, pick the version you want to use.

    • Type SQLVM as a VIRTUAL MACHINE NAME. Note that, in the Azure Portal, when you click a virtual machine name to open its Dashboard, you can see the virtual machine name as a host name.

    • Select the appropriate SIZE from the drop down list.

    • In the NEW USER NAME box, type unique user name as the local administrator.

    • In the NEW PASSWORD box, type a strong password.

    • In the CONFIRM PASSWORD box, retype the password.

  4. On the Virtual machine configuration page, provide the following information:

    • Select Standalone Virtual Machine.

    • In the CLOUD SERVICE DNS NAME box, provide the first portion of a DNS name of your choice, so that it completes a name in the format SQLVM2013.cloudapp.net.

    • In the REGION/AFFINITY GROUP/VIRTUAL NETWORK box, select a virtual network where this virtual image will be hosted. In this tutorial, select TestVirtualNetwork that you created earlier.

    • In the STORAGE ACCOUNT box, choose the storage account teststorageaccount4u that you created earlier.

    • When you select the virtual network TestVirtualNetwork in the previous step, the first subnet associated with this virtual network will show up in the VIRTUAL NETWORK SUBNETS box by default. If you have not created a subnet for the virtual network, the VIRTUAL NETWORK SUBNETS box will not show up on the screen. Otherwise, select the subnet TestSubnet that you created earlier.

    • In the AVAILABILITY SET box, select (None).

    • Click the next arrow to continue.

    • Next, review the new endpoints that will be created to allow connections to the virtual machine, such through Remote Desktop or a Secure Shell (SSH) client. You also can add endpoints now, or create them later. If you want to create endpoints later, see How to Set Up Communication with a Virtual Machine.

    • Read and accept the legal terms.

    • Click the check mark in the bottom right corner to continue.

  5. Azure creates the virtual machine and configures the operating system settings. Note that the provisioning process might take a few minutes. After Azure completes provisioning the virtual machine, it is listed as Running in the Azure Management Portal. If it is listed as Stopped, click Start. When you create a virtual machine, a cloud service is created for you. The cloud service that is created to contain the first virtual machine is not shown in the Management Portal until you connect additional virtual machines to the first machine. Azure defines the name of this new cloud service by using the DNS name entered in the Virtual machine mode page.

  6. In the Azure Management Portal, click SQLVM virtual machine name you just created to open its Dashboard.

  7. Take note of the Internal IP Address of the virtual machine. You will use it in the connection string later.

  8. At the bottom menu, click Connect and log in to the virtual machine using Remote Desktop (RDP). Use the Administrator credentials to log in.

    Remote Desktop Connection in Windows Azure
  9. The first time you log on to this virtual machine, several processes may need to complete, including setup of your desktop, Windows updates, and completion of the Windows initial configuration tasks (sysprep). After Windows sysprep completes, SQL Server setup completes configuration tasks. Once you are connected to the virtual machine with Windows Remote Desktop, the virtual machine works much like any other computer. You can connect to the default instance of SQL Server with SQL Server Management Studio (running on the virtual machine) in the normal way.

  10. Next, you need to configure SQL Server to listen on the TCP protocol. To do this, click Start | All Programs | Microsoft SQL Server | Configuration Tools and open SQL Server Configuration Manager. Note that the version of SQL Server you choose at Start | All Programs | Microsoft SQL Server should match the version you chose when you created the virtual machine.

  11. In SQL Server Configuration Manager, expand SQL Server Network Configuration in the console pane.

  12. Click Protocols for instance name. (The default instance is Protocols for MSSQLSERVER).

  13. In the details pane, right-click TCP, it should be Enabled for the gallery images by default. For your custom images, click Enable (if its status is Disabled.)

  14. In the console pane, click SQL Server Services.

  15. In the details pane, right-click SQL Server (instance name) (the default instance is SQL Server (MSSQLSERVER), and then click Restart, to stop and restart the instance of SQL Server.

  16. Then, you need to open TCP ports in the Windows firewall for the default instance of the Database Engine. To do this, click Start | All Programs | Administrative Tools, and open Windows Firewall with Advanced Security.

    Windows Firewall Settings
  17. In the Windows Firewall with Advanced Security, in the left pane, right-click Inbound Rules, and then click New Rule in the action pane.

  18. In the Rule Type dialog box, select Port, and then click Next.

  19. In the Protocol and Ports dialog box, select TCP. Select Specific local ports, and then type the port number of the instance of the Database Engine (1433 for the default instance). Click Next.

  20. In the Action dialog box, select Allow the connection, and then click Next.

  21. In the Profile dialog box, select Domain, Private, Public, and then click Next.

  22. In the Name page, set the Inbound Rule's Name to SQLServerVM1Port and click Finish. Close Windows Firewall with Advanced Security window.

  23. Next, you need to configure SQL Server for mixed mode authentication. The SQL Server Database Engine cannot use Windows Authentication without domain environment. To do this, click All Programs | Microsoft SQL Server (version), and then click SQL Server Management Studio.

  24. In the Connect to Server dialog box, for the Server name, type the host name of the virtual machine to connect to the Database Engine with the Object Explorer. Select Windows Authentication. Click Connect.

  25. In SQL Server Management Studio Object Explorer, right-click the name of the instance of SQL Server (the virtual machine name), and then click Properties.

  26. On the Security page, under Server authentication, select SQL Server and Windows Authentication mode, and then click OK.

    Server Properties
  27. In Object Explorer, right-click your server, and then click Restart.

  28. Next, you need to create a SQL Server authentication login to connect to the first virtual machine from another computer. To do this, in SQL Server Management Studio Object Explorer, expand the SQLVM server instance in which you want to create the new login. Right-click the Security folder, point to New, and select Login….

  29. In the Login – New dialog box, on the General page, enter the name of the new user sqlvmlogin in the Login name box. Select SQL Server authentication. In the Password box, enter a password for the new user. Enter that password again into the Confirm Password box. Leave default values in other boxes.

  30. On the Server Roles page, click sysadmin, if you want to designate this login as a SQL Server administrator. Click OK. By default, Azure selects Windows Authentication during SQL Server Virtual Machine setup. Therefore, the sa login is disabled and a password is assigned by setup. To use the sa login, enable it and also assign a new password. For more information, see Change Server Authentication Mode.

  31. In SQL Server Management Studio Object Explorer, right-click the name of the instance of SQL Server (the virtual machine name), and then click Disconnect.

Create a sample database in the new SQL Server Virtual Machine

Next, create a sample database that will be used by the ASP.NET application.

  1. In SQL Server Management Studio Object Explorer, click Connect and then click Database Engine….

  2. In the Connect to Server dialog box, for the Server name, type the host name of the virtual machine SQLVM to connect to the Database Engine. Select SQL Server Authentication. Type sqlvmlogin as a login name and enter the password you specified earlier. Click Connect.

  3. In SQL Server Management Studio Object Explorer, right-click the name of the instance of SQL Server (the virtual machine name), and then right-click New Query.

  4. Run the following statement to create a sample database.

    CREATE DATABASE TestDb;
    GO
    
  5. Under Databases, select the new database, TestDB. Right-click on the TestDB database and open New Query window. Run the following statements to create two rows in the TestDB database.

    CREATE TABLE Table1 (Col1 int primary key, Col2 varchar(20));
    GO
    INSERT INTO Table1 (Col1, Col2) VALUES (1, 'string1'), (2, 'string2');
    GO
    
    WarningWarning
    By default, Azure keeps all the operating system and SQL Server software in the operating system drive (C:\). For better performance, we recommend that you attach data disks to your virtual machine to keep all your data and log files. In addition, we recommend not to store any data in the temporary storage drive (D:\) as it is not persistent. For more information on attaching disks in Azure, see How to Attach a Data Disk to a Virtual Machine. For more information on how to change the default locations of new data and log files in SQL Server by using SQL Server Management Studio, see View or Change the Default Locations for Data and Log Files.

Create a simple ASP.NET web application (e.g. platform-as-a-service application) and configure a Web Role to connect to a SQL Server running in a virtual machine in Azure in the same virtual network

In this section, you will learn how to create a simple ASP.NET application in your local on-premises computer and configure it to connect to a SQL Server database instance in an Azure virtual machine. This example uses the GridView control to enable you to insert, update, and delete data from a database without writing any code.

Create the GridView Control

  1. In Visual Studio, on the File menu, click New and select Project.

  2. In the New Project dialog box, in the Installed Templates list, select Azure Cloud Service for either Visual C# or Visual Basic.

  3. Type DataBinding for the name and then click OK.

  4. In the New Azure Cloud Service dialog box, select ASP.NET Web Role from the NET Framework roles list and then click the arrow to add it to the Azure Cloud Service Solution list. Click OK. With Visual Studio 2013, select Web Forms in the New ASP.NET Project for the WebRole. Then, click OK.

  5. In Default.aspx, click Design to switch to the design view.

  6. Drag the GridView control from the Toolbox - Data to the design surface.

  7. In the Properties window for the GridView, set AutoGenerateDeleteButton and AutoGenerateEditButton to true.

Bind the GridView Control to the Data Source

  1. In Solution Explorer, in the Web Role project, double-click Web.config.

  2. In Web.config, replace the existing connectionStrings tag as follows and modify as needed:

    <connectionStrings>
        <add name="SQLServerinWAConnection" 
        connectionString="Data Source=tcp:SQLVMInternalIPAddress;Initial Catalog=TestDb;User ID=sqlvmlogin;Password=yourpassword;Encrypt=true;Trusted_Connection=false;TrustServerCertificate=true"
        providerName="System.Data.SqlClient" />
    </connectionStrings>
    
    When TrustServerCertificate is set to true, you request that the transport layer will use SSL to encrypt the channel and bypass walking the certificate chain to validate trust. For more information, see Encrypting Connections to SQL Server.

    WarningWarning
    Make sure to update tcp:SQLVMInternalIPAdress with the new virtual machine’s internal IP address, such as tcp:10.4.2.4. In addition, make sure to update the password with the password you specified for the login sqlvmlogin earlier.

    When you deploy your Azure Project to a virtual network, you don’t need to handle the name resolution between instances. In other words, if you deploy a web role that will connect to a SQL Server running on a virtual machine in the same virtual network, you need to specify the IP address of the SQL server in your web.config file. That’s why we recommend that you create the SQL Server virtual machine first so that you can get the virtual machine’s internal IP address for your web application.

  3. To get the IP address of the virtual machine, log in to the Management Portal. Click Virtual Machines. Click your new virtual machine, SQLVM, to open its dashboard. Copy the Internal IP Address to your web.config file as shown above.

  4. In Default.aspx, click Source to switch to the source view.

  5. Add the following markup to create a SqlDataSource control for your connection in the BodyContent tag in the Default.aspx source file:

    <asp:SqlDataSource ID="SQLServerDataSource" runat="server" 
       ConnectionString="<%$ ConnectionStrings: SQLServerinWAConnection %>" 
       InsertCommand="INSERT INTO [Table1] ([Col1], [Col2]) VALUES (@Col1, @Col2)" 
       SelectCommand="SELECT * FROM [Table1]" 
       UpdateCommand="UPDATE [Table1] SET [Col2] = @Col2 WHERE [Col1] = @Col1"
       DeleteCommand="DELETE FROM [Table1] WHERE [Col1] = @Col1">
       <UpdateParameters>
          <asp:Parameter Name="Col2" Type="String" />
          <asp:Parameter Name="Col1" Type="Int32" />
       </UpdateParameters>
       <InsertParameters>
          <asp:formParameter Name="Col1" FormField="TextBox1" />
          <asp:formParameter Name="Col2" FormField="TextBox2" />
       </InsertParameters>
       <DeleteParameters>
          <asp:Parameter Name="Col1" Type="Int32" />
       </DeleteParameters>
    </asp:SqlDataSource>
    
    This includes the SELECT, INSERT, UPDATE, and DELETE logic for the control.

  6. In the Default.aspx, switch to Design mode. Click GridView control that you recently added. In the Properties window of the GridView control, add the following attributes to the markup of your GridView control: DataSourceID="SQLServerDataSource" and DataKeyNames="Col1".

  7. Developers can freely design their ASP.NET pages based on their application’s requirements. For this tutorial, when using Visual Studio 2013, you may modify the Default.aspx source as follows:

    <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebRole1._Default" %>
    
    <asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
    
        <div class="jumbotron">
            <h1>ASP.NET</h1>
            <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS, and JavaScript.</p>
            <p><a href="http://www.asp.net" class="btn btn-primary btn-large">Learn more &raquo;</a></p>
        </div>
    
        <div class="row">
            <div class="col-md-4">
                <h2>Getting started                
                </h2>
                <p>
                    ASP.NET Web Forms lets you build dynamic websites using a familiar drag-and-drop, event-driven model.
                A design surface and hundreds of controls and components let you rapidly build sophisticated, powerful UI-driven sites with data access.
                </p>
                <asp:GridView ID="GridView2" runat="server" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" DataKeyNames="Col1" DataSourceID="SQLServerDataSource">
                    </asp:GridView>
                
                <asp:SqlDataSource ID="SQLServerDataSource" runat="server" 
                    ConnectionString="<%$ ConnectionStrings: SQLServerinWAConnection %>" 
                    InsertCommand="INSERT INTO [Table1] ([Col1], [Col2]) VALUES (@Col1, @Col2)" 
                    SelectCommand="SELECT * FROM [Table1]" 
                    UpdateCommand="UPDATE [Table1] SET [Col2] = @Col2 WHERE [Col1] = @Col1"
                    DeleteCommand="DELETE FROM [Table1] WHERE [Col1] = @Col1">
                <UpdateParameters>
                    <asp:Parameter Name="Col2" Type="String" />
                    <asp:Parameter Name="Col1" Type="Int32" />
                </UpdateParameters>
                <InsertParameters>
                    <asp:formParameter Name="Col1" FormField="TextBox1" />
                    <asp:formParameter Name="Col2" FormField="TextBox2" />
                </InsertParameters>
                <DeleteParameters>
                    <asp:Parameter Name="Col1" Type="Int32" />
                </DeleteParameters>
    </asp:SqlDataSource>
            </div>
                 
        </div>
        </asp:Content>
    
    
    
  8. Add the following tag to the Web.config file right after the <compilation> tag in the <system.web> tag:

    <customErrors mode="Off"/>
    
    This will ensure that the stack trace of any error message is displayed while running this application.

  9. (Optional Step) If you want to test your application in your local on-premises development environment, run Visual Studio as an Administrator. Then, make sure that the connection string points to the local SQL Server database instance. For local testing, create the sample database and the table in your on-premises server. Then, replace the <connectionStrings> tag in the Web.config as shown below.

    <connectionStrings>
        <add name="SQLServerinWAConnection" connectionString="Data Source=tcp:SQLVMInternalIPAddress;Initial Catalog=TestDb;User ID=sqlvmlogin;Password=yourpassword;Encrypt=true;Trusted_Connection=false;TrustServerCertificate=true"
        providerName="System.Data.SqlClient" />
        <add name="SQLServerLocalConnection" connectionString="Data Source=localhost;Initial Catalog=TestDb;Trusted_Connection=true"
        providerName="System.Data.SqlClient" />
    </connectionStrings>
    
    In addition, update the ConnectingString attribute in the Default.aspx source file to point the local server as follows:

    ConnectionString="<%$ ConnectionStrings:SQLServerLocalConnection %>"
    
    Then, press F5 to run the solution.

Bind the Visual Studio Project to Azure Virtual Network

You can deploy a Virtual Machine to an Azure Virtual Network in the Management Portal. But, currently, you cannot specify virtual network settings for your Azure cloud service project via the portal. You need to update the networking configuration settings in the .cscfg file of your Azure deployment package. In the solution, there are two service configuration files:

  • ServiceConfiguration.Cloud.csfg : Use this configuration file to set your application for Azure Cloud Deployment.

  • ServiceConfiguration.Local.csfg : Use this file for local configuration, which can be used for debugging your application in Compute Emulator.

  1. In order to enable communication between the Web Role and the SQL Server virtual machine, you need configure the Web Role to connect to the same Virtual Network as the SQL Server virtual machine. To do so, you need to update the ServiceConfiguration.Cloud.cscfg file. Expand the DataBinding project in the Solution Explorer. The service configuration files should appear right after Roles in Visual Studio. Open the ServiceConfiguration.Cloud.cscfg file and add the following NetworkConfiguration element right after the last Role tag.

    <NetworkConfiguration>
          <VirtualNetworkSite name="TestVirtualNetwork" />
          <AddressAssignments>
              <InstanceAddress roleName="WebRole1">
                 <Subnets>
                    <Subnet name="FrontEndSubnet" />
               </Subnets>
            </InstanceAddress>
       </AddressAssignments>
     </NetworkConfiguration>
    
    Note that if you don’t specify values in the Virtual Network elements sections of the service configuration file, the cloud service won’t be deployed into a Virtual Network. For more information, see NetworkConfiguration Schema. If you deploy your own DNS server in the Azure platform, you need to specify the DNS server for your web/worker role instances in the .csfg file as well.

    WarningWarning
    Make sure that VirtualNetworkSite name and Subnet name match the names you have used earlier when you created the virtual network.

  2. Once you set the settings in the configuration file, open the Role Property dialog window to select which configuration you want to use. To do this, right-click WebRole1 in the Solution Explorer. Open the WebRole1’s Properties window. Select Configuration. In the Service Configuration box, choose Cloud.

  3. Press F6 to build the solution.

    WarningWarning
    Having virtual machines and Azure web/worker roles in the same Azure Virtual Network provides low latency and more secure connectivity.

Package and deploy the ASP.NET cloud service to be hosted in the same virtual network in Azure

In this section, you will publish a web application to Azure by creating a package using Visual Studio. Then, you will use that package to create a cloud service in the same virtual network that you used to create a SQL Server virtual machine in earlier.

  1. To publish the web application to Azure, in the Visual Studio-Solution Explorer, right-click the DataBinding project and select Package.

  2. In the Package Azure Application dialog window, make sure that Service Configuration is set to Cloud and Build Configuration is set to Release. Then, click the Package button.

    WarningWarning
    If you see an error stating that Visual Studio cannot overwrite the existing <project folder>\bin\Release\app.publish folder, delete the existing package files manually. Then, repeat the previous two steps to create a new package.

  3. Log on to the Management Portal.

  4. Click +NEW at the bottom of the page, select COMPUTE, Cloud Service and then Custom Create.

  5. In the Create a cloud service window, enter DataBinding in the URL text box, select TestAffinityGroup from the Region/Affinity Group selection list and check the Deploy a Cloud Service package now option. Click the next arrow to continue.

  6. In the Publish your cloud service window, enter a name for the new deployment (for example, DataBinding). Browse to the location for your package and configuration files (e.g. <project folder>\bin\Release\app.publish) and check the Deploy even if one or more roles contain a single instance option.

  7. You can use the Add certificates now check box when you want to secure your application by using an SSL encryption. For more information, see Configuring SSL for an application in Azure.

  8. Then, click the check mark button to complete. Note that creating a cloud service might take a few minutes.

  9. To see all the resources in your Virtual Network, click NETWORKS in the left pane. Then, click TestVirtualNetwork to open its Dashboard.

  10. To run the application, click Cloud Services on the left pane. Then, click DataBinding cloud service to open its Dashboard. Click Site URL to run the application.

  11. If you use Visual Studio 2013 to build this ASP.NET application, the following screen should appear when the application runs.

    SQL Server ASP.NET Application in Windows Azure VM
WarningWarning
This tutorial does not show how to secure your cloud service by using SSL Encryption or the service-level certificates. We recommended that you always secure your application and connection strings in your application.

If you want to provide secure interactions for users of your cloud service, use the service certificates. If you want to publish your cloud service from Visual Studio to Azure directly, use the management certificates. For more information on certificates, see Managing Certificates in Azure. For more information on how to configure a service certificate, see Configuring SSL for an application in Azure and How to Configure an SSL Certificate on an HTTPS Endpoint.

We also recommend that you deploy your packaged application to the staging environment in Azure to be tested before you move it to the production environment in which the application is accessible on the Internet. For more information, see Staging an application in Azure.

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft