【问题标题】:Microsoft.Azure.Management give access to Virtual MachinesMicrosoft.Azure.Management 授予对虚拟机的访问权限
【发布时间】:2020-05-29 09:37:19
【问题描述】:

我使用 Microsoft.Azure.Management 来管理我的租户的虚拟机,使用 clientId、clientSecret 和tenantId。 如果另一个租户想让我访问管理他的虚拟机,是否可以使用这种方式连接到他的虚拟机,只更改tenantId?

是否可以使用 Microsoft 授权授予对虚拟机的访问权限?又会是怎样的流程?

或者哪种方式最适合我的需求?

using Microsoft.Azure.Management.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent.Authentication;
//...

var creds = new AzureCredentialsFactory().FromServicePrincipal(clientId, clientSecret, tenantId, AzureEnvironment.AzureGlobalCloud);

IAzure azure = Azure.Authenticate(creds).WithDefaultSubscription();

var machines = azure.VirtualMachines.List().ToList();

【问题讨论】:

    标签: c# azure azure-management-api


    【解决方案1】:

    如果另一个租户想要让我访问管理他的虚拟 机器,是否可以使用此连接到他的虚拟机 方式,只更改tenantId?

    仅更改租户 ID 将不起作用,因为您为访问 VM 而创建的服务主体 (SP) 驻留在原始租户中。不知何故,您需要将该 SP 链接到其他租户。

    请参阅此答案以获取更多详细信息:Grant service principal access to application in other tenant

    【讨论】:

      猜你喜欢
      • 2016-07-10
      • 1970-01-01
      • 1970-01-01
      • 2012-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-20
      • 2021-02-25
      相关资源
      最近更新 更多