使用全局管理员用户名和密码在 Azure AD 中创建应用程序的代码
Code that creates Application in Azure AD with global administrator username and password
我找到了通过 Azure AD Grapgh 创建 Azure AD 应用程序的代码示例 API。
var application = new Application()
{
AvailableToOtherTenants = false,
DisplayName = appname,
ErrorUrl = null,
GroupMembershipClaims = null,
Homepage = string.Format("http://www.{0}.com", _azureDomain),
IdentifierUris = new List<string>() { { string.Format("https://{0}/{1}",_azureDomain, appname )} },
KeyCredentials = new List<KeyCredential>(),
KnownClientApplications = new List<Guid>(),
LogoutUrl = null,
Oauth2AllowImplicitFlow = false,
Oauth2AllowUrlPathMatching = false,
Oauth2Permissions = new List<OAuth2Permission>();
}
await graphClient.Applications.AddApplicationAsync(application);
但我没有找到仅使用全局管理员凭据而无需为此目的手动创建其他应用程序的 graphClient 实例化示例。
Here in section 9 there is explanation of how this application has to be created.
这是正确的吗?要使用全局管理员凭据进行身份验证需要创建应用程序吗?
如果我错了并且可以进行这种身份验证,有人可以添加它的代码示例吗?
有点像"chicken and egg"场景。
除非调用应用程序已注册,否则您无法访问图表 API。
因此您需要在 AAD 租户中手动创建包含您的代码的应用程序,并授予其对租户的写入权限。
我找到了通过 Azure AD Grapgh 创建 Azure AD 应用程序的代码示例 API。
var application = new Application()
{
AvailableToOtherTenants = false,
DisplayName = appname,
ErrorUrl = null,
GroupMembershipClaims = null,
Homepage = string.Format("http://www.{0}.com", _azureDomain),
IdentifierUris = new List<string>() { { string.Format("https://{0}/{1}",_azureDomain, appname )} },
KeyCredentials = new List<KeyCredential>(),
KnownClientApplications = new List<Guid>(),
LogoutUrl = null,
Oauth2AllowImplicitFlow = false,
Oauth2AllowUrlPathMatching = false,
Oauth2Permissions = new List<OAuth2Permission>();
}
await graphClient.Applications.AddApplicationAsync(application);
但我没有找到仅使用全局管理员凭据而无需为此目的手动创建其他应用程序的 graphClient 实例化示例。
Here in section 9 there is explanation of how this application has to be created.
这是正确的吗?要使用全局管理员凭据进行身份验证需要创建应用程序吗?
如果我错了并且可以进行这种身份验证,有人可以添加它的代码示例吗?
有点像"chicken and egg"场景。
除非调用应用程序已注册,否则您无法访问图表 API。
因此您需要在 AAD 租户中手动创建包含您的代码的应用程序,并授予其对租户的写入权限。