Skip to content

Commit 0a59236

Browse files
authored
Merge pull request #105504 from mamccrea/asa-arm-deploy
Stream Analytics: how to export/deploy arm
2 parents edcf7ee + 5ffe0ed commit 0a59236

File tree

4 files changed

+70
-0
lines changed

4 files changed

+70
-0
lines changed

articles/stream-analytics/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@
167167
href: https://github.com/Azure/azure-stream-analytics/tree/master/Samples/ASAOneClick
168168
- name: Using API for IoT Edge jobs
169169
href: stream-analytics-cicd-api.md
170+
- name: Export and deploy with Azure Resource Manager
171+
href: resource-manager-export.md
170172
- name: Visual Studio
171173
items:
172174
- name: Install tools
141 KB
Loading
48.3 KB
Loading
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: Export an Azure Stream Analytics job Azure Resource Manager template
3+
description: This article describes how to export an Azure Resource Manager template for your Azure Stream Analytics job.
4+
services: stream-analytics
5+
author: mamccrea
6+
ms.author: mamccrea
7+
ms.service: stream-analytics
8+
ms.topic: conceptual
9+
ms.date: 03/10/2020
10+
---
11+
12+
# Export an Azure Stream Analytics job Azure Resource Manager template
13+
14+
[Azure Resource Manager templates](../azure-resource-manager/templates/overview.md) allow you to implement infrastructure as code. The template is a JavaScript Object Notation (JSON) file that defines the infrastructure and configuration for your resources. You specify the resources to deploy and the properties for those resources.
15+
16+
You can redeploy an Azure Stream Analytics job by exporting the Azure Resource Manager template.
17+
18+
## Open a job in VS Code
19+
20+
Before you can export a template, you must first open an existing Stream Analytics job in Visual Studio Code.
21+
22+
To export a job to a local project, locate the job you wish to export in the **Stream Analytics Explorer** in the Azure portal. From the **Query** page, select **Open in Visual Studio**. Then select **Visual Studio Code**.
23+
24+
![Open Stream Analytics job in Visual Studio Code](./media/resource-manager-export/open-job-vs-code.png)
25+
26+
For more information on using Visual Studio Code to manage Stream Analytics jobs, see the [Visual Studio Code quickstart](quick-create-vs-code.md).
27+
28+
## Compile the script
29+
30+
The next step is to compile the job script to an Azure Resource Manager template. Before you compile the script, ensure that your job has at least one input and one output configured. If no input or output is configured, you need to configure the input and output first.
31+
32+
1. In Visual Studio Code, navigate to your job's *Transformation.asaql* file.
33+
34+
![Transformation.asaql file in Visual Studio Code](./media/resource-manager-export/transformation-asaql.png)
35+
36+
1. Right-click the *Transformation.asaql* file and select **ASA: Compile Script** from the menu.
37+
38+
1. Notice that a **Deploy** folder appears in your Stream Analytics job workspace.
39+
40+
1. Explore the *JobTemplate.json* file, which is the Azure Resource Management template used to deploy.
41+
42+
## Complete the parameters file
43+
44+
Next, complete the Azure Resource Management template parameters file.
45+
46+
1. Open the *JobTemplate.parameters.json* file located in the **Deploy** folder of your Stream Analytics job workspace in Visual Studio Code.
47+
48+
1. Notice that the input and output keys are null. Replace the null values with the actual access keys for your input and output resources.
49+
50+
1. Save the parameters file.
51+
52+
## Deploy using templates
53+
54+
You're ready to deploy your Azure Stream Analytics job using the Azure Resource Manager templates you generated in the previous section.
55+
56+
In a PowerShell window, run the following command. Be sure to reaplce the *ResourceGroupName*, *TemplateFile*, and *TemplateParameterFile* with your actual resource group name, and the complete file paths to the *JobTemplate.json* and *JobTemplate.parameters.json* files in the **Deploy Folder** of your job workspace.
57+
58+
If you don't have Azure PowerShell configured, follow the steps in [Install Azure PowerShell module](https://docs.microsoft.com/powershell/azure/install-Az-ps).
59+
60+
```azurepowershell
61+
New-AzResourceGroupDeployment -ResourceGroupName "<your resource group>" -TemplateFile "<path to JobTemplate.json>" -TemplateParameterFile "<path to JobTemplate.parameters.json>"
62+
```
63+
64+
## Next steps
65+
66+
* [Test Azure Stream Analytics jobs locally with live input using Visual Studio Code](visual-studio-code-local-run-live-input.md)
67+
68+
* [Explore Azure Stream Analytics jobs with Visual Studio Code (Preview)](visual-studio-code-explore-jobs.md)

0 commit comments

Comments
 (0)