Azure AD SingleSignOn出错

时间:2017-07-04 14:08:05

标签: c# asp.net azure

我订阅了azure和已经开发的应用程序,我尝试使用Azure AD作为身份验证机制。

我在Azure中创建了应用程序,将Azure AD添加为身份验证机制,当我尝试登录时出现此错误。

  

AADSTS65005:该应用需要访问服务   (" http://rts.powerapps.com")您的组织   " 123-32323-323232-3233"尚未订阅或启用。联系你的   IT管​​理员可以查看服务订阅的配置。

这是我的启动课程。

public partial class Startup
{

    private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"];
    private static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"];
    private static string tenant = ConfigurationManager.AppSettings["ida:Tenant"];
    private static string postLogoutRedirectUri = ConfigurationManager.AppSettings["ida:PostLogoutRedirectUri"];

    string authority = String.Format(CultureInfo.InvariantCulture, aadInstance, tenant);

    public void ConfigureAuth(IAppBuilder app)
    {
        app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

        app.UseCookieAuthentication(new CookieAuthenticationOptions());

        app.UseOpenIdConnectAuthentication(
            new OpenIdConnectAuthenticationOptions
            {
                ClientId = clientId,
                Authority = authority,
                PostLogoutRedirectUri = postLogoutRedirectUri,
                RedirectUri = postLogoutRedirectUri,
                Notifications = new OpenIdConnectAuthenticationNotifications
                {
                    AuthenticationFailed = context => 
                    {
                        context.HandleResponse();
                        context.Response.Redirect("/Error?message=" + context.Exception.Message);
                        return Task.FromResult(0);
                    }
                }
            });
    }
}

有什么想法吗?

编辑1:

从我现在删除的所需权限中删除某些应用后,我收到此错误。

Error Img

编辑2:

在删除并再次添加权限后修复。

1 个答案:

答案 0 :(得分:0)

您似乎正在使用基于服务的公共数据服务进行开发(" http://rts.powerapps.com")。请确保您的组织没有订阅该服务(" http://rts.powerapps.com")。

请注意Common Data Service的先决条件:

  
      
  1. 如果您已注册PowerApp,则可以访问PowerApp并登录。如果您尚未注册,则可以按照这些说明进行注册。
  2.   
  3. 确保您具有对包含公共数据服务数据库的环境的管理员访问权限。转到PowerApps门户,单击页面右上角的齿轮图标,然后单击管理中心。如果您不具有对包含数据库的任何环境的管理员访问权限,请按照这些说明创建数据库。
  4.   

以下是帮助您入门的有用文档:

Get started with the Common Data Service SDK