使用证书指纹访问 PowerBI API 失败

问题描述 投票:0回答:1

为了在 Powershell 中使用 PowerBI API,我设置了 Azure 应用程序并安装了证书。

我尝试以这种方式连接到 API:

Connect-PowerBIServiceAccount -ServicePrincipal -CertificateThumbprint "xxxxxxxxxxx" -ApplicationId "xxxxxxxxxxxxxx" 

但是,我只得到这个不太有用的错误:

„At least one error occured.,Microsoft.PowerBI.Commands.Profile.ConnectPowerBIServiceAccount“

有什么可能遗漏的提示吗?

azure powershell powerbi powerbi-embedded
1个回答
0
投票

我注册了一个名为 PowerBiDec 的应用程序并向其添加了证书,如下所示:

enter image description here

最初,当我尝试使用证书指纹连接 Power BI 时,我也遇到了同样的错误

Connect-PowerBIServiceAccount -ServicePrincipal -CertificateThumbprint "xxxxxxxxxxx" -ApplicationId "xxxxxxxxxxxxxx" 

enter image description here

为了解决错误,我按照以下步骤关闭所有打开的 PowerShell 会话并手动删除所有 MicrosoftPowerBIMgmt 模块(文件夹)并再次安装。

确保在 Power BI 管理门户中

启用允许访问服务主体的以下设置:

enter image description here

现在,我以 ADmin 身份运行这些 PowerShell 命令并使用证书指纹成功连接到 Power BI:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Unregister-PSRepository -Name PSGallery Register-PSRepository -Default Find-Module MicrosoftPowerBIMgmt Install-Module MicrosoftPowerBIMgmt -force -AllowClobber Connect-PowerBIServiceAccount -ServicePrincipal -CertificateThumbprint "xxxxxxxxxx" -ApplicationId "xxxxxxx"

回复:

enter image description here

当我运行下面的命令时,我得到了

access token 的响应,如下所示:

Get-PowerBIAccessToken | fl

回复:

enter image description here

参考资料:

(PowerShell)Connect-PowerBIServiceAccount 不... - Microsoft Fabric 社区,作者:agneum

无需预先准备即可从 Power Shell 连接 PowerBI... - Microsoft Fabric Community by kranthi_sunkara

© www.soinside.com 2019 - 2024. All rights reserved.