title | description | services | author | manager | editor | documentationcenter | ms.assetid | ms.service | ms.workload | ms.tgt_pltfrm | ms.devlang | ms.topic | ms.date | ms.author |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Deploy DocumentDB and Azure App Service Web Apps using an Azure Resource Manager Template | Microsoft Docs |
Learn how to deploy a DocumentDB account, Azure App Service Web Apps, and a sample web application using an Azure Resource Manager template. |
documentdb, app-service\web |
h0n |
jhubbard |
monicar |
087d8786-1155-42c7-924b-0eaba5a8b3e0 |
documentdb |
data-services |
na |
na |
article |
08/02/2016 |
hawong |
This tutorial shows you how to use an Azure Resource Manager template to deploy and integrate Microsoft Azure DocumentDB, an Azure App Service web app, and a sample web application.
Using Azure Resource Manager templates, you can easily automate the deployment and configuration of your Azure resources. This tutorial shows how to deploy a web application and automatically configure DocumentDB account connection information.
After completing this tutorial, you will be able to answer the following questions:
- How can I use an Azure Resource Manager template to deploy and integrate a DocumentDB account and a web app in Azure App Service?
- How can I use an Azure Resource Manager template to deploy and integrate a DocumentDB account, a web app in App Service Web Apps, and a Webdeploy application?
Tip
While this tutorial does not assume prior experience with Azure Resource Manager templates or JSON, should you wish to modify the referenced templates or deployment options, then knowledge of each of these areas will be required.
Before following the instructions in this tutorial, ensure that you have the following:
- An Azure subscription. Azure is a subscription-based platform. For more information about obtaining a subscription, see Purchase Options, Member Offers, or Free Trial.
Let's start by downloading the template files we will use in this tutorial.
- Download the Create a DocumentDB account, Web Apps, and deploy a demo application sample template to a local folder (e.g. C:\DocumentDBTemplates). This template will deploy a DocumentDB account, an App Service web app, and a web application. It will also automatically configure the web application to connect to the DocumentDB account.
- Download the Create a DocumentDB account and Web Apps sample template to a local folder (e.g. C:\DocumentDBTemplates). This template will deploy a DocumentDB account, an App Service web app, and will modify the site's application settings to easily surface DocumentDB connection information, but does not include a web application.
Now let's deploy our first template.
Tip
The template does not validate that the web app name and DocumentDB account name entered below are a) valid and b) available. It is highly recommended that you verify the availability of the names you plan to supply prior to submitting the deployment.
-
Login to the Azure Portal, click New and search for "Template deployment".
-
Click Edit template, paste the contents of the DocDBWebsiteTodo.json template file, and click Save.
-
Click Edit parameters, provide values for each of the mandatory parameters, and click OK. The parameters are as follows:
-
SITENAME: Specifies the App Service web app name and is used to construct the URL that you will use to access the web app (e.g. if you specify "mydemodocdbwebapp", then the URL by which you will access the web app will be mydemodocdbwebapp.azurewebsites.net).
-
HOSTINGPLANNAME: Specifies the name of App Service hosting plan to create.
-
LOCATION: Specifies the Azure location in which to create the DocumentDB and web app resources.
-
DATABASEACCOUNTNAME: Specifies the name of the DocumentDB account to create.
-
-
Choose an existing Resource group or provide a name to make a new resource group, and choose a location for the resource group.
-
Click Review legal terms, Purchase, and then click Create to begin the deployment. Select Pin to dashboard so the resulting deployment is easily visible on your Azure portal home page.
-
When the deployment finishes, the Resource group blade will open.
-
To use the application, simply navigate to the web app URL (in the example above, the URL would be http://mydemodocdbwebapp.azurewebsites.net). You'll see the following web application:
-
Go ahead and create a couple of tasks in the web app and then return to the Resource group blade in the Azure portal. Click the DocumentDB account resource in the Resources list and then click Query Explorer.
-
Run the default query, "SELECT * FROM c" and inspect the results. Notice that the query has retrieved the JSON representation of the todo items you created in step 7 above. Feel free to experiment with queries; for example, try running SELECT * FROM c WHERE c.isComplete = true to return all todo items which have been marked as complete.
-
Feel free to explore the DocumentDB portal experience or modify the sample Todo application. When you're ready, let's deploy another template.
Now let's deploy our second template. This template is useful to show how you can inject DocumentDB connection information such as account endpoint and master key into a web app as application settings or as a custom connection string. For example, perhaps you have your own web application that you would like to deploy with a DocumentDB account and have the connection information automatically populated during deployment.
Tip
The template does not validate that the web app name and DocumentDB account name entered below are a) valid and b) available. It is highly recommended that you verify the availability of the names you plan to supply prior to submitting the deployment.
-
In the Azure Portal, click New and search for "Template deployment".
-
Click Edit template, paste the contents of the DocDBWebSite.json template file, and click Save.
-
Click Edit parameters, provide values for each of the mandatory parameters, and click OK. The parameters are as follows:
-
SITENAME: Specifies the App Service web app name and is used to construct the URL that you will use to access the web app (e.g. if you specify "mydemodocdbwebapp", then the URL by which you will access the web app will be mydemodocdbwebapp.azurewebsites.net).
-
HOSTINGPLANNAME: Specifies the name of App Service hosting plan to create.
-
LOCATION: Specifies the Azure location in which to create the DocumentDB and web app resources.
-
DATABASEACCOUNTNAME: Specifies the name of the DocumentDB account to create.
-
-
Choose an existing Resource group or provide a name to make a new resource group, and choose a location for the resource group.
-
Click Review legal terms, Purchase, and then click Create to begin the deployment. Select Pin to dashboard so the resulting deployment is easily visible on your Azure portal home page.
-
When the deployment finishes, the Resource group blade will open.
-
Click the Web App resource in the Resources list and then click Application settings
-
Note how there are application settings present for the DocumentDB endpoint and each of the DocumentDB master keys.
-
Feel free to continue exploring the Azure Portal, or follow one of our DocumentDB samples to create your own DocumentDB application.
Congratulations! You've deployed DocumentDB, App Service web app and a sample web application using Azure Resource Manager templates.
- To learn more about DocumentDB, click here.
- To learn more about Azure App Service Web apps, click here.
- To learn more about Azure Resource Manager templates, click here.
- For a guide to the change from Websites to App Service see: Azure App Service and Its Impact on Existing Azure Services
- For a guide to the change of the old portal to the new portal see: Reference for navigating the Azure Classic Portal
Note
If you want to get started with Azure App Service before signing up for an Azure account, go to Try App Service, where you can immediately create a short-lived starter web app in App Service. No credit cards required; no commitments.