Skip to content

Commit a952316

Browse files
authored
Merge pull request #167129 from zeinab-mk/zeinam-purview
update azure purview register scan power bi
2 parents 89f9adb + 5b8bdbc commit a952316

File tree

1 file changed

+91
-1
lines changed

1 file changed

+91
-1
lines changed

articles/purview/register-scan-power-bi-tenant.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: csugunan
66
ms.service: purview
77
ms.subservice: purview-data-catalog
88
ms.topic: how-to
9-
ms.date: 11/19/2020
9+
ms.date: 07/28/2021
1010
---
1111

1212
# Register and scan a Power BI tenant (preview)
@@ -104,6 +104,96 @@ Now that you've given the Purview Managed Identity permissions to connect to the
104104

105105
:::image type="content" source="media/setup-power-bi-scan-catalog-portal/save-run-power-bi-scan.png" alt-text="Save and run Power BI screen image":::
106106

107+
## Register and scan a cross-tenant Power BI (preview)
108+
109+
In a cross-tenant scenario, you can use PowerShell to register and scan your Power BI tenants, however, you can view, browse and search assets of remote tenant using Azure Purview Studio through the UI experience.
110+
111+
Consider using this guide if the Azure AD tenant where Power BI tenant is located, is different than the Azure AD tenant where your Azure Purview account is being provisioned.
112+
Use the following steps to register and scan one or more Power BI tenants in Azure Purview in a cross-tenant scenario:
113+
114+
1. Download the [Managed Scanning PowerShell Modules](https://github.com/Azure/Purview-Samples/blob/master/Cross-Tenant-Scan-PowerBI/ManagedScanningPowerShell.zip), and extract its contents to the location of your choice.
115+
116+
2. On your computer, enter **PowerShell** in the search box on the Windows taskbar. In the search list, right-click **Windows PowerShell**, and then select **Run as administrator**.
117+
118+
3. In the PowerShell window, enter the following command, replacing `<path-to-managed-scanning-powershell-modules>` with the folder path of the extracted modules such as `C:\Program Files\WindowsPowerShell\Modules\ManagedScanningPowerShell`
119+
120+
```powershell
121+
dir -Path <path-to-managed-scanning-powershell-modules> -Recurse | Unblock-File
122+
```
123+
124+
4. Enter the following command to install the PowerShell modules.
125+
126+
```powershell
127+
Import-Module 'C:\Program Files\WindowsPowerShell\Modules\ManagedScanningPowerShell\Microsoft.DataCatalog.Management.Commands.dll'
128+
```
129+
5. Use the same PowerShell session to set the following parameters. Update `purview_tenant_id` with Azure AD tenant ID where Azure Purview is deployed, `powerbi_tenant_id` with your Azure AD tenant where Power BI tenant is located and `purview_account_name` is your existing Azure Purview account.
130+
131+
```powershell
132+
$azuretenantId = '<purview_tenant_id>'
133+
$powerBITenantIdToScan = '<powerbi_tenant_id>'
134+
$purviewaccount = '<purview_account_name>'
135+
```
136+
6. Create a cross-tenant Service Principal.
137+
138+
1. Create an App Registration in your Azure Active Directory tenant where Power BI is located:
139+
140+
```powershell
141+
New-AzAdApplication -DisplayName 'powerbispn'
142+
$obj = (Get-AzADApplication -DisplayName powerbispn).ObjectId
143+
$azurePassword = New-Guid | ConvertTo-SecureString -AsPlainText -Force
144+
$date = Get-Date
145+
$newCredential = New-AzADAppCredential -ObjectId $obj -Password $azurePassword -StartDate $date -EndDate $date.AddYears(1)
146+
```
147+
148+
2. From Azure Active Directory dashboard select newly created application and then select _App registration_. Grant admin consent for the tenant and assign the application the following permissions:
149+
- Power BI Service Tenant.Read.All
150+
- Microsoft Graph openid
151+
152+
3. Construct tenant specific sign-in URL for your service principal by running the following url in your web browser:
153+
154+
https://login.microsoftonline.com/<purview_tenant_id>/oauth2/v2.0/authorize?client_id=<client_id_to_delegate_the_pbi_admin>&scope=openid&response_type=id_token&response_mode=fragment&state=1234&nonece=67890
155+
156+
Make sure you replace the parameters with correct information:
157+
<purview_tenant_id> is the Azure Active Directory tenant ID (GUID) where Azure Purview account is provisioned.
158+
<client_id_to_delegate_the_pbi_admin> is the application ID corresponding to your service principal
159+
160+
4. Sign-in using any non-admin account. This is required to provision your service principal in the foreign tenant.
161+
162+
7. Update `client_id_to_delegate_the_pbi_admin` with Application (client) ID of newly created application and run the following command in your PowerShell session:
163+
164+
```powershell
165+
$ServicePrincipalId = '<client_id_to_delegate_the_pbi_admin>'
166+
```
167+
168+
9. Create a user account in Azure Active Directory tenant and assign Azure AD role, Power BI Administrator. Update `pbi_admin_username` and `pbi_admin_password` with corresponding information and execute the following lines in the PowerShell terminal:
169+
170+
```powershell
171+
$UserName = '<pbi_admin_username>'
172+
$Password = '<pbi_admin_password>'
173+
```
174+
8. In Azure Purview subscription, locate your Purview account and using Azure RBAC roles, assign _Purview Data Source Administrator_ to the Service Principal and the Power BI user.
175+
176+
10. To register the cross-tenant Power BI tenant as a new data source inside Azure Purview account, update `service_principal_key` and execute the following cmdlets in the PowerShell session:
177+
178+
```powershell
179+
Set-AzDataCatalogSessionSettings -DataCatalogSession -TenantId $azuretenantId -ServicePrincipalAuthentication -ServicePrincipalApplicationId $ServicePrincipalId -ServicePrincipalKey '<service_principal_key>' -Environment Production -DataCatalogAccountName $purviewaccount
180+
181+
Set-AzDataCatalogDataSource -Name 'pbidatasource' -AccountType PowerBI -Tenant $powerBITenantIdToScan -Verbose
182+
```
183+
184+
11. To create and run a new scan inside Azure Purview execute the following cmdlets in the PowerShell session:
185+
186+
```powershell
187+
Set-AzDataCatalogScan -DataSourceName 'pbidatasource' -Name 'pbiscan' -AuthorizationType PowerBIDelegated -ServicePrincipalId $ServicePrincipalId -UserName $UserName -Password $Password -IncludePersonalWorkspaces $true -Verbose
188+
189+
Start-AzDataCatalogScan -DataSourceName 'pbidatasource' -Name 'pbiscan'
190+
```
191+
### Known limitations
192+
193+
- For cross-tenant scenario, no UX experience currently available to register and scan cross Power BI tenant.
194+
- By Editing the Power BI cross tenant registered with PowerShell using Purview Studio will tamper the data source registration with inconsistent scan behavior.
195+
196+
107197
## Next steps
108198
109199
- [Browse the Azure Purview Data catalog](how-to-browse-catalog.md)

0 commit comments

Comments
 (0)