Skip to content

Commit 23a8aa0

Browse files
committed
sql msi and synapse output
1 parent 4f5f490 commit 23a8aa0

10 files changed

+147
-7
lines changed

articles/stream-analytics/TOC.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,18 @@
127127
href: copy-job.md
128128
- name: Pair jobs for reliability
129129
href: stream-analytics-job-reliability.md
130-
- name: Authenticate with managed identity - ADLS Gen 1 output
131-
href: stream-analytics-managed-identities-adls.md
132130
- name: Use SQL reference data
133131
href: sql-reference-data.md
134-
- name: Authenticate with managed identity - Blob output
135-
href: blob-output-managed-identity.md
136-
- name: Authenticate with managed identity - Power BI
137-
href: powerbi-output-managed-identity.md
132+
- name: Authenticate with managed identity
133+
items:
134+
- name: ADLS Gen 1
135+
href: stream-analytics-managed-identities-adls.md
136+
- name: Blob storage
137+
href: blob-output-managed-identity.md
138+
- name: Power BI
139+
href: powerbi-output-managed-identity.md
140+
- name: Azure SQL DB
141+
href: sql-db-output-managed-identity.md
138142
- name: Encrypt your data
139143
href: data-protection.md
140144
- name: Build solutions
97.4 KB
Loading
20.4 KB
Loading
89 KB
Loading
85.8 KB
Loading
29.5 KB
Loading
159 KB
Loading
87.1 KB
Loading
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
title: Use managed identities to access Azure SQL Database - Azure Stream Analytics
3+
description: This article describes how to use managed identities to authenticate your Azure Stream Analytics job to Azure SQL DB output.
4+
author: mamccrea
5+
ms.author: mamccrea
6+
ms.service: stream-analytics
7+
ms.topic: conceptual
8+
ms.date: 05/08/2020
9+
---
10+
11+
# Use managed identities to access Azure SQL Database from an Azure Stream Analytics job (Preview)
12+
13+
Azure Stream Analytics supports [Managed Identity authentication](../active-directory/managed-identities-azure-resources/overview.md) for Azure SQL Database output sinks. Managed identities eliminate the limitations of user-based authentication methods, like the need to reauthenticate due to password changes or user token expirations that occur every 90 days. When you remove the need to manually authenticate, your Stream Analytics deployments can be fully automated.
14+
15+
A managed identity is a managed application registered in Azure Active Directory that represents a given Stream Analytics job. The managed application is used to authenticate to a targeted resource. This article shows you how to enable Managed Identity for an Azure SQL Database output(s) of a Stream Analytics job through the Azure portal.
16+
17+
## Prerequisites
18+
19+
The following are required to this feature:
20+
21+
- An Azure Stream Analytics job.
22+
23+
- An Azure SQL Database resource.
24+
25+
## Create a managed identity
26+
27+
First, you create a managed identity for your Azure Stream Analytics job.
28+
29+
1. In the [Azure portal](https://portal.azure.com), open your Azure Stream Analytics job.
30+
31+
1. From the left navigation menu, select **Managed Identity** located under **Configure**. Then, check the box next to **Use System-assigned Managed Identity** and select **Save**.
32+
33+
![Select system-assigned managed identity](./media/sql-db-output-managed-identity/system-assigned-managed-identity.png)
34+
35+
36+
A service principal for the Stream Analytics job's identity is created in Azure Active Directory. The life cycle of the newly created identity is managed by Azure. When the Stream Analytics job is deleted, the associated identity (that is, the service principal) is automatically deleted by Azure.
37+
38+
1. When you save the configuration, the Object ID (OID) of the service principal is listed as the Principal ID as shown below:
39+
40+
![Object ID shown as Principal ID](./media/sql-db-output-managed-identity/principal-id.png)
41+
42+
The service principal has the same name as the Stream Analytics job. For example, if the name of your job is *MyASAJob*, the name of the service principal is also *MyASAJob*.
43+
44+
## Select an Active Directory admin
45+
46+
After you've created a managed identity, you select an Active Directory admin.
47+
48+
1. Navigate to your Azure SQL Database resource and select the SQL Server that the database is under. You can find the SQL Server name next to *Server name* on the resource overview page.
49+
50+
1. Select **Active Directory Admin** under **Settings**. Then, select **Set admin**.
51+
52+
![Active Directory admin page](./media/sql-db-output-managed-identity/active-directory-admin-page.png)
53+
54+
1. On the Active Directory admin page, search for a user or group to be an administrator for the SQL Server and click **Select**.
55+
56+
![Add Active Directory admin](./media/sql-db-output-managed-identity/add-admin.png)
57+
58+
1. Select **Save** on the **Active Directory admin** page. The process for changing admin takes a few minutes.
59+
60+
## Create a database user
61+
62+
Next, you create a contained database user in your SQL Database that is mapped to the Azure Active Directory identity. The contained database user doesn't have a login for the master database, but it maps to an identity in the directory that is associated with the database. The Azure Active Directory identity can be an individual user account or a group. In this case, you want to create a contained database user for your Stream Analytics job.
63+
64+
1. Connect to the SQL database using SQL Server Management Studio. The **User name** is an Azure Active Directory user with the **ALTER ANY USER** permission. The admin you set on the SQL Server is an example. Use **Azure Active Directory – Universal with MFA** authentication.
65+
66+
![Connect to SQL Server](./media/sql-db-output-managed-identity/connect-sql-server.png)
67+
68+
The server name `<SQL Server name>.database.windows.net` may be different in different regions. For example, the China region should use `<SQL Server name>.database.chinacloudapi.cn`.
69+
70+
You can specify a specific SQL Database by going to **Options > Connection Properties > Connect to Database**.
71+
72+
![SQL Server connection properties](./media/sql-db-output-managed-identity/sql-server-connection-properties.png)
73+
74+
1. When you connect for the first time, you may encounter the following window:
75+
76+
![New firewall rule window](./media/sql-db-output-managed-identity/new-firewall-rule.png)
77+
78+
1. If so, go to your SQL Server resource on the Azure portal. Under the **Security** section, open the **Firewalls and virtual network** page.
79+
1. Add a new rule with any rule name.
80+
1. Use the *From* IP address from the **New Firewall Rule** window for the *Start IP*.
81+
1. Use the *To* IP address from the **New Firewall Rule** window for *End IP*.
82+
1. Select **Save** and attempt to connect from SQL Server Management Studio again.
83+
84+
1. Once you are connected, create the contained database user. The following SQL command creates a contained database user that has the same name as your Stream Analytics job. Be sure to include the brackets around the *ASA_JOB_NAME*. Use the following T-SQL syntax and run the query.
85+
86+
```sql
87+
CREATE USER [ASA_JOB_NAME] FROM EXTERNAL PROVIDER;
88+
```
89+
90+
## Grant Stream Analytics job permissions
91+
92+
The Stream Analytics job has permission from Managed Identity to **CONNECT** to your SQL Database resource. Most likely, it would be efficient to allow the Stream Analytics job to run commands such as **SELECT**. You can grant those permissions to the Stream Analytics job using SQL Server Management Studio. For more information, see the [GRANT (Transact-SQL)](https://docs.microsoft.com/sql/t-sql/statements/grant-transact-sql?view=sql-server-ver15) reference.
93+
94+
Alternatively, you can right-click on your SQL database in SQL Server Management Studio and select **Properties > Permissions**. From the permissions menu, you can see the Stream Analytics job you added previously, and you can manually grant or deny permissions as you see fit.
95+
96+
## Create an Azure SQL Database output
97+
98+
Now that your managed identity is configured, you're ready to add the Azure SQL Database as output to your Stream Analytics job.
99+
100+
1. Go back to your Stream Analytics job, and navigate to the **Outputs** page under **Job Topology**.
101+
102+
1. Select **Add > SQL Database**. In the output properties window of the SQL Database output sink, select **Managed Identity** from the Authentication mode drop-down.
103+
104+
1. Fill out the rest of the properties. To learn more about creating an SQL Database output, see [Create a SQL Database output with Stream Analytics](stream-analytics-define-outputs.md#sql-database). When you are finished, select **Save**.
105+
106+
## Next steps
107+
108+
* [Understand outputs from Azure Stream Analytics](stream-analytics-define-outputs.md)
109+
* [Azure Stream Analytics output to Azure SQL Database](stream-analytics-sql-output-perf.md)

articles/stream-analytics/stream-analytics-define-outputs.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: mamccrea
66
ms.reviewer: mamccrea
77
ms.service: stream-analytics
88
ms.topic: conceptual
9-
ms.date: 02/14/2020
9+
ms.date: 05/8/2020
1010
---
1111

1212
# Understand outputs from Azure Stream Analytics
@@ -61,6 +61,33 @@ The following table lists the property names and their description for creating
6161
|Inherit partition scheme| An option for inheriting the partitioning scheme of your previous query step, to enable fully parallel topology with multiple writers to the table. For more information, see [Azure Stream Analytics output to Azure SQL Database](stream-analytics-sql-output-perf.md).|
6262
|Max batch count| The recommended upper limit on the number of records sent with every bulk insert transaction.|
6363

64+
There are two adapters that enable output from Azure Stream Analytics to Azure Synapse Analytics (formerly SQL Data Warehouse): SQL Database and Azure Synapse. We recommend that you choose the Azure Synapse Analytics adapter instead of the SQL Database adapter if any of the following conditions hold true:
65+
66+
* **Throughput**: If your expected throughput now or in the future is greater than 10MB/sec, use the Azure Synapse output option for better performance.
67+
68+
* **Input Partitions**: If you have eight or more input partitions, use the Azure Synapse output option for better scale-out.
69+
70+
## Azure Synapse Analytics (Preview)
71+
72+
[Azure Synapse Analytics](https://azure.microsoft.com/services/synapse-analytics) (formerly SQL Data Warehouse) is a limitless analytics service that brings together enterprise data warehousing and Big Data analytics.
73+
74+
Azure Stream Analytics jobs can output to a SQL pool table in Azure Synapse Analytics and can process throughput rates up to 200MB/sec. This supports the most demanding real-time analytics and hot-path data processing needs for workloads such as reporting and dashboarding.
75+
76+
The SQL pool table must exist before you can add it as output to your Stream Analytics job. The table's schema must match the fields and their types in your job's output.
77+
78+
To use Azure Synapse as output, you need to ensure that you have the storage account configured. Navigate to Storage account settings to configure the storage account. Only the storage account types that support tables are permitted: General-purpose V2 and General-purpose V1.
79+
80+
The following table lists the property names and their descriptions for creating am Azure Synapse Analytics output.
81+
82+
|Property name|Description|
83+
|-|-|
84+
|Output alias |A friendly name used in queries to direct the query output to this database. |
85+
|Database |SQL pool name where you're sending your output. |
86+
|Server name |Azure Synapse server name. |
87+
|Username |The username that has write access to the database. Stream Analytics supports only SQL authentication. |
88+
|Password |The password to connect to the database. |
89+
|Table | The table name where the output is written. The table name is case-sensitive. The schema of this table should exactly match the number of fields and their types that your job output generates.|
90+
6491
## Blob storage and Azure Data Lake Gen2
6592

6693
Data Lake Storage Gen2 makes Azure Storage the foundation for building enterprise data lakes on Azure. Designed from the start to service multiple petabytes of information while sustaining hundreds of gigabits of throughput, Data Lake Storage Gen2 allows you to easily manage massive amounts of data.A fundamental part of Data Lake Storage Gen2 is the addition of a hierarchical namespace to Blob storage.

0 commit comments

Comments
 (0)