azure - Power BI - 使用托管标识从 Azure SQL 数据库获取数据

标签 azure powerbi azure-managed-identity

我有一个简单的场景,其中我有一个 Azure SQL 数据库,并且我想在 Power BI 报表中使用数据库中的数据。数据库服务器仅启用了 Azure AD 身份验证。到目前为止,我设法使用自己的凭据(身份验证方法:OAuth2)创建和刷新数据集,但我想要一个不依赖用户帐户的更通用的解决方案。

是否可以为 Power BI 工作区启用托管标识并使用它连接到 Azure SQL DB 并获取数据?这样,Power BI 将使用其他 Azure 服务访问数据库所使用的相同模式。

如果尚不支持 Power BI 托管身份,那么在不使用用户帐户的情况下提取数据的最佳替代方案是什么?

最佳答案

If Power BI managed identity is not supported yet, what would be the best alternative to pull the data without using a user account?

据我所知,只有 Azure 流分析作业支持托管身份作为 Power BI 的身份验证。

但作为一种解决方法,您可以利用 Azure 服务主体或 Azure AD 应用程序对连接到 Azure SQL 的 Power BI 数据集进行身份验证。

我创建了一个 Power BI 组,其中存在我的 Azure AD 服务主体和用户。

我使用 Powerbi 连接到我的 Azure SQL 服务器,如下所示:-

enter image description here

enter image description here

从 Azure SQL 数据集创建了一份 PowerBi 报告,如下所示:-

enter image description here

已将其上传到 PowerBi Web :-

enter image description here

我有一个 PowerBI 嵌入组,其中包含嵌入演示应用程序和可以访问 Power BI 的用户,如下所示:-

enter image description here

登录我的 Power BI 门户网站 > 设置 > 管理门户 > 租户设置

enter image description here

启用允许嵌入设置:-

enter image description here

允许服务主体使用 Power BI 并授予 powerbiembedgroup 访问权限。

enter image description here

为服务主体提供对工作区或特定数据集的访问权限:-

enter image description here

enter image description here

通过 Powershell 访问 PowerBI:-

安装 PowerBI Powershell 模块 -

Install-Module -Name MicrosoftPowerBIMgmt

使用 SP 连接到 PowerBI -

Connect-PowerBIServiceAccount -ServicePrincipal -Credential (Get-Credential) -Tenant xxxxxxxx-xxxx-xxexx-99ed-af9038592395

enter image description here

在用户名和密码中添加服务主体的应用程序 ID 和密码。

已成功连接到 PowerBI :-

enter image description here

获取工作区 -

   Get-PowerBIWorkspace

引用文献:-

Embed Power BI content in an embedded analytics application with service principal and an application secret - Power BI | Microsoft Learn

Use Managed Identity to authenticate your Azure Stream Analytics job to Power BI output | Microsoft Learn

关于azure - Power BI - 使用托管标识从 Azure SQL 数据库获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75594823/

相关文章:

powershell - 从 WebJob/WebApp 访问注册表

azure - 自定义属性分配 Azure ADB2C

powerbi - 电源 BI : Multiple condition in single if condition

sql-server - 具有用户分配的托管标识的 Azure SQL 数据库连接池

python-3.x - 从 Azure Blob 存储、Flask Python、HTML/JS 检索并显示?

azure - 将 Azure AD 集成到 Java Web 应用程序中

azure - Power BI 与 Azure 分析服务

POWERBI - 未将对象引用设置为对象的实例

triggers - 如何在 Azure Function 中使用 Azure Managed Identity 通过触发器访问 Service Bus?

azure - 无法在同一 Arm 模板中引用 Key Vault 的用户分配身份的principalId