我正在尝试设置我的服务主体用于Power BI Embedded分页报告。根据这里,我无法使用主用户设置。(虽然我最初确实设置了主用户)。在我看来,我似乎卡在第6步,因为他们显示的管理门户与我的不同。Microsoft显示我没有的租户设置。
x1c 0d1x这是我的帐户在没有租户设置的情况下显示的图片。
我正在运行AppOwnsData的示例代码,我的配置文件(在appsettings.json中)正在通过他们的验证服务。
// ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// ----------------------------------------------------------------------------
namespace AppOwnsData.Services
{
using AppOwnsData.Models;
using Microsoft.Extensions.Options;
using System;
public class ConfigValidatorService
{
/// <summary>
/// Validates whether all the configuration parameters are set in appsettings.json file
/// </summary>
/// <param name="appSettings">Contains appsettings.json configuration values</param>
/// <returns></returns>
public static string ValidateConfig(IOptions<AzureAd> azureAd, IOptions<PowerBI> powerBI)
{
string message = null;
bool isAuthModeMasterUser = azureAd.Value.AuthenticationMode.Equals("masteruser", StringComparison.InvariantCultureIgnoreCase);
bool isAuthModeServicePrincipal = azureAd.Value.AuthenticationMode.Equals("serviceprincipal", StringComparison.InvariantCultureIgnoreCase);
if (string.IsNullOrWhiteSpace(azureAd.Value.AuthenticationMode))
{
message = "Authentication mode is not set in appsettings.json file";
}
else if (string.IsNullOrWhiteSpace(azureAd.Value.AuthorityUrl))
{
message = "Authority is not set in appsettings.json file";
}
else if (string.IsNullOrWhiteSpace(azureAd.Value.ClientId))
{
message = "Client Id is not set in appsettings.json file";
}
else if (isAuthModeServicePrincipal && string.IsNullOrWhiteSpace(azureAd.Value.TenantId))
{
message = "Tenant Id is not set in appsettings.json file";
}
else if (azureAd.Value.ScopeBase is null || azureAd.Value.ScopeBase.Length == 0)
{
message = "Scope base is not set in appsettings.json file";
}
else if (string.IsNullOrWhiteSpace(powerBI.Value.WorkspaceId))
{
message = "Workspace Id is not set in appsettings.json file";
}
else if (!IsValidGuid(powerBI.Value.WorkspaceId))
{
message = "Please enter a valid guid for Workspace Id in appsettings.json file";
}
else if (string.IsNullOrWhiteSpace(powerBI.Value.ReportId))
{
message = "Report Id is not set in appsettings.json file";
}
else if (!IsValidGuid(powerBI.Value.ReportId))
{
message = "Please enter a valid guid for Report Id in appsettings.json file";
}
else if (isAuthModeMasterUser && string.IsNullOrWhiteSpace(azureAd.Value.PbiUsername))
{
message = "Master user email is not set in appsettings.json file";
}
else if (isAuthModeMasterUser && string.IsNullOrWhiteSpace(azureAd.Value.PbiPassword))
{
message = "Master user password is not set in appsettings.json file";
}
else if (isAuthModeServicePrincipal && string.IsNullOrWhiteSpace(azureAd.Value.ClientSecret))
{
message = "Client secret is not set in appsettings.json file";
}
return message;
}
/// <summary>
/// Checks whether a string is a valid guid
/// </summary>
/// <param name="configParam">String value</param>
/// <returns>Boolean value indicating validity of the guid</returns>
private static bool IsValidGuid(string configParam)
{
Guid result = Guid.Empty;
return Guid.TryParse(configParam, out result);
}
}
}
字符串
我得到的错误是
错误详细信息:操作返回了无效的状态代码“未经授权”
在Microsoft.PowerBI.API.ReportsOperations.GetReportInGroupWithHttpMessagesAsync(GUID groupId、GUID reportId、字典`2 customHeaders、CancellationToken cancellationToken),位于Microsoft.PowerBI.API.ReportsOperationsExtensions.GetReportInGroupAsync(IReportsOperations操作、GUID groupId、GUID reportId、CancellationToken cancellationToken),位于Microsoft.PowerBI.API.ReportsOperationsExtensions.GetReportInGroup(IReportsOperations操作,GuidgroupId,GuidreportId)位于AppOwnsData.Services.PbiEmbedService.GetEmbedParams C中的(GUID workspaceId、GUID reportId、GUID additionalDatasetId):\Users\AA\Downloads\PowerBI-Developer-Samples-master\PowerBI-Developer-Samples-master.NET Core\Embed for your customers\AppOwnsData\Services\PbiEmbedService.cs:line 46 at AppOwnsData.Controllers.EmbedInfoController.GetEmbedInfo()in C:\Users\AA\Downloads\PowerBI-Developer-Samples-master\PowerBI-Developer-Samples-master.NET Core\Embed for your customers\AppOwnsData\Controllers\EmbedInfoController.cs:line 45
我正在试用,但我没有看到任何东西表明这不是试用的一部分。我也在我的帐户中的其他地方找过,但找不到任何类似的东西。任何帮助都很感激。如果需要更多细节,请联系我们。
1条答案
按热度按时间u59ebvdq1#
注意:要访问PowerBI Admin Portal中的租户设置,用户必须具有结构管理员/全局管理员。
最初,当我尝试与用户登录时,我遇到了同样的问题:
x1c 0d1x的数据
因此,为了解决此错误,我为用户分配了Fabric Administrator角色,如下所示:
的
的
分配角色后,我可以访问租户设置:
的
这也将解决“操作返回了无效的状态代码'未经授权”错误。