azure-active-directory - “权限不足,无法完成操作。” 尝试以编程方式创建新的 Azure AD 应用程序时
问题描述
我正在尝试以编程方式创建 Azure AD 应用程序(C# 脚本)我已将对 AddApplicationAsync 的调用包装在 try-catch 中
当我运行它时,我收到异常消息“权限不足,无法完成操作。”,
public void CreateNewClientApplication(string pName, Guid pResourceAppId)
{
var newClientApp = new Application();
newClientApp.DisplayName = pName;
newClientApp.ReplyUrls.Add(CreateDummyReplyUrl(pName));
newClientApp.PasswordCredentials = new List<PasswordCredential>() {
new PasswordCredential()
{
Value = "xxxxxxxxx",
KeyId = Guid.NewGuid(),
StartDate = DateTime.UtcNow,
EndDate = DateTime.UtcNow.AddYears(2),
}
};
RequiredResourceAccess resource = new RequiredResourceAccess();
resource.ResourceAppId = pResourceAppId.ToString();
newClientApp.RequiredResourceAccess.Add(resource);
var activeDirectoryClient = AuthenticationHelper.GetActiveDirectoryClientAsApplication();
try
{
activeDirectoryClient.Applications.AddApplicationAsync(newClientApp).Wait();
}
catch (Exception ex)
{
// EXCEPTION-MESSAGE: "Insufficient privileges to complete the operation."
}
}
所以我的问题是,需要什么权限? 我有这些
解决方案
推荐阅读
- arrays - 使用 Swift sorted(by:) 方法时数组排序不正确
- devise - 使用 capybara 自动化测试为 Google Oauth 2 的登录存根
- scala - Scala - 如何将字符串值传递给数据框过滤器(Spark-Shell)
- knime - Knime HDFS 连接节点不工作
- ruby-on-rails - Rails 将 json 渲染到 AngularJS 前端。时间变为 00:00:00
- python - ValueError:轮廓级别必须增加 - 已排序的数组
- python - 从单个导入访问 python 应用程序中的全局变量
- java - JLabels 在 Mac 上具有透明背景,但在 Windows 上却没有?
- sql - 如何在 Crystal Report 中使用的 SQL 语句的 Where 子句中使用参数?
- mysql - 安装mysql2(0.3.21)时出错,Bundler无法继续