Microsoft.Azure.Management授予对虚拟机的访问权限

问题描述 投票:0回答:1

我使用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个回答
0
投票

[如果另一个租户希望给我访问权限以管理他的虚拟机器,是否可以使用此连接到他的虚拟机方式,仅更改tenantId?

仅更改租户ID将不起作用,因为您创建用于访问VM的服务主体(SP)位于原始租户中。您将需要以某种方式将SP链接到其他租户。

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

© www.soinside.com 2019 - 2024. All rights reserved.