|
| 1 | +--- |
| 2 | +title: Deploy to Azure button |
| 3 | +description: Use button to deploy Azure Resource Manager templates from a GitHub repository. |
| 4 | +ms.topic: conceptual |
| 5 | +ms.date: 02/05/2020 |
| 6 | +--- |
| 7 | +# Use a deployment button to deploy templates from GitHub repository |
| 8 | + |
| 9 | +This article describes how to use the **Deploy to Azure** button to deploy templates from a GitHub repository. You can add the button directly to the README.md file in your GitHub repository or to a web page that references the repository. |
| 10 | + |
| 11 | +## Use common image |
| 12 | + |
| 13 | +To add the button to your web page or repository, use the following image: |
| 14 | + |
| 15 | +```html |
| 16 | +<img src="https://aka.ms/deploytoazurebutton"/> |
| 17 | +``` |
| 18 | + |
| 19 | +The image appears as: |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +## Create URL for deploying template |
| 24 | + |
| 25 | +To create the URL for your template, start with the raw URL to the template in your repo: |
| 26 | + |
| 27 | +```html |
| 28 | +https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-storage-account-create/azuredeploy.json |
| 29 | +``` |
| 30 | + |
| 31 | +Then, URL encode it. You can use an online encoder or run a command. The following PowerShell example shows how to URL encode a value. |
| 32 | + |
| 33 | +```powershell |
| 34 | +[uri]::EscapeDataString($url) |
| 35 | +``` |
| 36 | + |
| 37 | +The example URL has the following value when URL encoded. |
| 38 | + |
| 39 | +```html |
| 40 | +https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-storage-account-create%2Fazuredeploy.json |
| 41 | +``` |
| 42 | + |
| 43 | +Each link starts with the same base URL: |
| 44 | + |
| 45 | +```html |
| 46 | +https://portal.azure.com/#create/Microsoft.Template/uri/ |
| 47 | +``` |
| 48 | + |
| 49 | +Add your URL-encoded template link to the end of the base URL. |
| 50 | + |
| 51 | +```html |
| 52 | +https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-storage-account-create%2Fazuredeploy.json |
| 53 | +``` |
| 54 | + |
| 55 | +You have your full URL for the link. |
| 56 | + |
| 57 | +## Create Deploy to Azure button |
| 58 | + |
| 59 | +Finally, put the link and image together. You can add this HTML to either the README.md file in your GitHub repository or a web page. |
| 60 | + |
| 61 | +```html |
| 62 | +<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-storage-account-create%2Fazuredeploy.json" target="_blank"> |
| 63 | + <img src="https://aka.ms/deploytoazurebutton"/> |
| 64 | +</a> |
| 65 | +``` |
| 66 | + |
| 67 | +## Deploy the template |
| 68 | + |
| 69 | +To test the full solution, select the following button: |
| 70 | +<br><br> |
| 71 | +<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-storage-account-create%2Fazuredeploy.json" target="_blank"> |
| 72 | + <img src="https://aka.ms/deploytoazurebutton"/> |
| 73 | +</a> |
| 74 | + |
| 75 | +The portal displays a pane that allows you to easily provide parameter values. The parameters are pre-filled with the default values from the template. |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | +## Next steps |
| 80 | + |
| 81 | +- To learn more about templates, see [Understand the structure and syntax of Azure Resource Manager templates](template-syntax.md). |
0 commit comments