azure - 使用nodejs将Azure用户添加到资源组

标签 azure azure-active-directory azure-sdk

使用 Node.js SDK,我创建了一个用户和一个资源组。现在如何将用户作为所有者分配给资源组?

最佳答案

可以引用这个example .

authzClient.roleAssignments.create(scope, assignmentGuid, roleCreateParams, function (err, roleAssignment, req, res) {
  if (err) {
    console.log('\nError occured while creating the roleAssignment: \n' + util.inspect(err, { depth: null }));
    return;
  }

根据您的需要,您需要示例。

所有者角色 ID 为 8e3af657-a8ff-443c-a75c-2fe8c4bcb635

scope 应该像这样 /subscriptions/{subscription-id}/resourceGroups/myresourcegroup1

将应用程序 ID 替换为您的用户对象 ID。

此外,您可以使用 Azure Rest API 来执行此操作,请参阅此 link .

关于azure - 使用nodejs将Azure用户添加到资源组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46175010/

相关文章:

Azure AD 应用程序需要管理员批准错误 : App needs permission to access resources in your organization that only an admin can grant

azure - 使用 Node.js 从 Azure WebJob 轮询 Azure 服务总线队列

json - 使用 Powershell,如何将 Azure AD 组成员转换为 Json 对象(文件),然后进行更新?

Azure Ad 身份验证回复 url 包含 http 而不是带有 .netcore 中间件的 https - 如何强制执行 https?

从 VSCode 部署后,Python Azure 函数无法工作

asp.net-mvc - SignalR 似乎减慢了我的 MVC/Azure 应用程序的启动速度

angular - Azure 应用服务上的 Angular 应用程序出现应用程序错误

azure - 如何将特定项目属性传递给 PowerShell 中的变量?

java - 使用 Azure SDK for Java 调用 Azure Migrate Rest Api

c# - 从 Azure Management Fluent 创建 Azure 存储帐户时如何指定 CORS 设置