|
| 1 | +--- |
| 2 | +title: Provision access to Arc-enabled SQL Server for DevOps actions (preview) |
| 3 | +description: Step-by-step guide on provisioning access to Arc-enabled SQL Server through Microsoft Purview DevOps policies |
| 4 | +author: inward-eye |
| 5 | +ms.author: vlrodrig |
| 6 | +ms.service: purview |
| 7 | +ms.subservice: purview-data-policies |
| 8 | +ms.topic: how-to |
| 9 | +ms.date: 10/11/2022 |
| 10 | +ms.custom: |
| 11 | +--- |
| 12 | +# Provision access to Arc-enabled SQL Server for DevOps actions (preview) |
| 13 | + |
| 14 | +[!INCLUDE [feature-in-preview](includes/feature-in-preview.md)] |
| 15 | + |
| 16 | +[DevOps policies](concept-policies-devops.md) are a type of Microsoft Purview access policies. They allow you to manage access to system metadata on data sources that have been registered for *Data use management* in Microsoft Purview. These policies are configured directly in the Microsoft Purview governance portal, and after publishing, they get enforced by the data source. |
| 17 | + |
| 18 | +This how-to guide covers how to provision access from Microsoft Purview to Arc-enabled SQL Server system metadata (DMVs and DMFs) via *SQL Performance Monitoring* or *SQL Security Auditing* actions. Microsoft Purview access policies apply to Azure AD Accounts only. |
| 19 | + |
| 20 | +## Prerequisites |
| 21 | +[!INCLUDE [Access policies generic pre-requisites](./includes/access-policies-prerequisites-generic.md)] |
| 22 | +[!INCLUDE [Access policies Arc enabled SQL Server pre-requisites](./includes/access-policies-prerequisites-arc-sql-server.md)] |
| 23 | + |
| 24 | +## Microsoft Purview configuration |
| 25 | + |
| 26 | +### Register data sources in Microsoft Purview |
| 27 | +The Arc-enabled SQL Server data source needs to be registered first with Microsoft Purview, before policies can be created. |
| 28 | + |
| 29 | +1. Sign in to Microsoft Purview Studio. |
| 30 | + |
| 31 | +1. Navigate to the **Data map** feature on the left pane, select **Sources**, then select **Register**. Type "Azure Arc" in the search box and select **SQL Server on Azure Arc**. Then select **Continue** |
| 32 | + |
| 33 | + |
| 34 | +1. Enter a **Name** for this registration. It is best practice to make the name of the registration the same as the server name in the next step. |
| 35 | + |
| 36 | +1. select an **Azure subscription**, **Server name** and **Server endpoint**. |
| 37 | + |
| 38 | +1. **Select a collection** to put this registration in. |
| 39 | + |
| 40 | +1. Enable Data Use Management. Data Use Management needs certain permissions and can affect the security of your data, as it delegates to certain Microsoft Purview roles to manage access to the data sources. **Go through the secure practices related to Data Use Management in this guide**: [How to enable Data Use Management](./how-to-enable-data-use-management.md) |
| 41 | + |
| 42 | +1. Upon enabling Data Use Management, Microsoft Purview will automatically capture the **Application ID** of the App Registration related to this Arc-enabled SQL server. Come back to this screen and hit the refresh button on the side of it to refresh, in case the association between the Arc-enabled SQL server and the App Registration changes in the future. |
| 43 | + |
| 44 | +1. Select **Register** or **Apply** at the bottom |
| 45 | + |
| 46 | +Once your data source has the **Data Use Management** toggle *Enabled*, it will look like this picture. |
| 47 | + |
| 48 | + |
| 49 | +> [!Note] |
| 50 | +> If you want to create a policy on a resource group or subscription and have it enforced in Arc-enabled SQL servers, you will need to also register those servers independently for *Data use management* to provide their App ID. |
| 51 | +
|
| 52 | +## Create a new DevOps policy |
| 53 | +Follow this link for the steps to [create a new DevOps policy in Microsoft Purview](how-to-policies-devops-authoring-generic.md#create-a-new-devops-policy). |
| 54 | + |
| 55 | +## List DevOps policies |
| 56 | +Follow this link for the steps to [list DevOps policies in Microsoft Purview](how-to-policies-devops-authoring-generic.md#list-devops-policies). |
| 57 | + |
| 58 | +## Update a DevOps policy |
| 59 | +Follow this link for the steps to [update a DevOps policies in Microsoft Purview](how-to-policies-devops-authoring-generic.md#update-a-devops-policy). |
| 60 | + |
| 61 | +## Delete a DevOps policy |
| 62 | +Follow this link for the steps to [delete a DevOps policies in Microsoft Purview](how-to-policies-devops-authoring-generic.md#delete-a-devops-policy). |
| 63 | + |
| 64 | +>[!Important] |
| 65 | +> DevOps policies are auto-published and changes can take up to **5 minutes** to be enforced by the data source. |
| 66 | +
|
| 67 | +### Test the policy |
| 68 | + |
| 69 | +The Azure AD Accounts referenced in the access policies should now be able to connect to any database in the server to which the policies are published. |
| 70 | + |
| 71 | +#### Force policy download |
| 72 | +It is possible to force an immediate download of the latest published policies to the current SQL database by running the following command. The minimal permission required to run it is membership in ##MS_ServerStateManager##-server role. |
| 73 | + |
| 74 | +```sql |
| 75 | +-- Force immediate download of latest published policies |
| 76 | +exec sp_external_policy_refresh reload |
| 77 | +``` |
| 78 | + |
| 79 | +#### Analyze downloaded policy state from SQL |
| 80 | +The following DMVs can be used to analyze which policies have been downloaded and are currently assigned to Azure AD accounts. The minimal permission required to run them is VIEW DATABASE SECURITY STATE - or assigned Action Group *SQL Security Auditor*. |
| 81 | + |
| 82 | +```sql |
| 83 | + |
| 84 | +-- Lists generally supported actions |
| 85 | +SELECT * FROM sys.dm_server_external_policy_actions |
| 86 | + |
| 87 | +-- Lists the roles that are part of a policy published to this server |
| 88 | +SELECT * FROM sys.dm_server_external_policy_roles |
| 89 | + |
| 90 | +-- Lists the links between the roles and actions, could be used to join the two |
| 91 | +SELECT * FROM sys.dm_server_external_policy_role_actions |
| 92 | + |
| 93 | +-- Lists all Azure AD principals that were given connect permissions |
| 94 | +SELECT * FROM sys.dm_server_external_policy_principals |
| 95 | + |
| 96 | +-- Lists Azure AD principals assigned to a given role on a given resource scope |
| 97 | +SELECT * FROM sys.dm_server_external_policy_role_members |
| 98 | + |
| 99 | +-- Lists Azure AD principals, joined with roles, joined with their data actions |
| 100 | +SELECT * FROM sys.dm_server_external_policy_principal_assigned_actions |
| 101 | +``` |
| 102 | + |
| 103 | +## Additional information |
| 104 | + |
| 105 | +### Policy action mapping |
| 106 | + |
| 107 | +This section contains a reference of how actions in Microsoft Purview data policies map to specific actions in SQL Server on Azure Arc-enabled servers. |
| 108 | + |
| 109 | +| **Microsoft Purview policy action** | **Data source specific actions** | |
| 110 | +|-------------------------------------|--------------------------------------| |
| 111 | +| | | |
| 112 | +| *SQL Performance Monitor* |Microsoft.Sql/sqlservers/Connect | |
| 113 | +||Microsoft.Sql/sqlservers/databases/Connect | |
| 114 | +||Microsoft.Sql/sqlservers/databases/SystemViewsAndFunctions/DatabasePerformanceState/rows/select | |
| 115 | +||Microsoft.Sql/sqlservers/databases/SystemViewsAndFunctions/ServerPerformanceState/rows/select | |
| 116 | +||| |
| 117 | +| *SQL Security Auditor* |Microsoft.Sql/sqlservers/Connect | |
| 118 | +||Microsoft.Sql/sqlservers/databases/Connect | |
| 119 | +||Microsoft.Sql/sqlservers/SystemViewsAndFunctions/ServerSecurityState/rows/select | |
| 120 | +||Microsoft.Sql/sqlservers/databases/SystemViewsAndFunctions/DatabaseSecurityState/rows/select | |
| 121 | +||Microsoft.Sql/sqlservers/SystemViewsAndFunctions/ServerSecurityMetadata/rows/select | |
| 122 | +||Microsoft.Sql/sqlservers/databases/SystemViewsAndFunctions/DatabaseSecurityMetadata/rows/select | |
| 123 | +||| |
| 124 | + |
| 125 | +## Next steps |
| 126 | +Check the blog and related docs |
| 127 | +* Blog: [Microsoft Purview DevOps policies enable at scale access provisioning for IT operations](https://techcommunity.microsoft.com/t5/microsoft-purview-blog/microsoft-purview-devops-policies-enable-at-scale-access/ba-p/3604725) |
| 128 | +* Video: [Pre-requisite for policies: The "Data use management" option](https://youtu.be/v_lOzevLW-Q) |
| 129 | +* Video: [Microsoft Purview DevOps policies on data sources and resource groups](https://youtu.be/YCDJagrgEAI) |
| 130 | +* Video: [Reduce the effort with Microsoft Purview DevOps policies on resource groups](https://youtu.be/yMMXCeIFCZ8) |
| 131 | +* Doc: [Microsoft Purview DevOps policies on Azure SQL DB](./how-to-policies-devops-azure-sql-db.md) |
| 132 | +* Blog: [Deep dive on SQL Performance Monitor and SQL Security Auditor permissions](https://techcommunity.microsoft.com/t5/sql-server-blog/new-granular-permissions-for-sql-server-2022-and-azure-sql-to/ba-p/3607507) |
0 commit comments