本文介绍了Azure Function 角色,例如停止 Azure 虚拟机的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用预定的 C# Azure 函数来管理一些 Azure 资源.

I'm hoping to manage some Azure resources using a scheduled C# Azure Function.

目前在我制作的命令行应用程序中,我一直在使用库Microsoft.IdentityModel.Clients.ActiveDirectory"进行令牌授权,并使用Microsoft.Azure.Management.Compute"进行客户端调用,像这样进行资源管理.

Currently in a command line application I've made, I've been using libraries 'Microsoft.IdentityModel.Clients.ActiveDirectory' for token authorization and 'Microsoft.Azure.Management.Compute' for client calls for resource management like so.

//... var credential generated my AD authentication and extending Microsoft.Rest.ServiceClientCredentials
using (var client = new ComputeManagementClient(credential)) {
    client.SubscriptionId = "[SOME_SUBSCRIPTION_ID]";
    client.VirtualMachines.BeginPowerOff("[RESOURCE_GROUP]", "[VM_NAME]");
}

我的管理客户端是否可以在不提供用户凭据或类似凭据建立的密钥的情况下与 Azure 资源交互?

Can my management client interact with Azure resources without providing a User Credential or Key-Secret like credential establishment?

我之前的经历与 AWS 相关,不可否认,它混淆了我对 Azure 资源管理的看法.

My previous experience is related to AWS and admittedly it has confused my view of Azure Resource Management.

我看过的旧帖子是:启动和停止 Azure 虚拟机

是可以从 Azure 函数停止/启动 Azure ARM 虚拟机吗?

-编辑 1-

我希望基于具有各种权限的分配角色在 AWS 资源客户端中为 Lambda 提供类似于运行时凭证的东西.不过我会看看证书.

I was hoping for something similar to run-time credentials in AWS resource clients for Lambda based on an assigned role with a variety of permissions. I will have a look at certificates though.

推荐答案

好吧,我真的不明白您希望如何在不进行身份验证的情况下进行身份验证,我猜您唯一的选择是证书?
https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-daemon-certificate-credential/

Well, I don't really understand how do you expect to authenticate without authenticating, I guess your only option would be certificates?
https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-daemon-certificate-credential/

这篇关于Azure Function 角色,例如停止 Azure 虚拟机的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 12:16