问题描述
我正在使用Azure Batch C#客户端API 6.1。我正在尝试使所有运行都使用相同的用户身份。
I am using Azure Batch C# Client API 6.1. I am trying to have all my runs using the same user identity.
我正在按照文档。
var task = new CloudTask("{guid}", "command string")
{
DisplayName = "display name",
UserIdentity = new UserIdentity("customUserid")
}
但是,当作业运行时,任务会在一个随机用户帐户下执行。
However when the job runs, the task executes under a random user account.
任何人都知道如何使它工作或即使它得到了支持。后端Azure批处理服务?
Would anyone know how to make it work OR even if it is supported by the backend Azure Batch service?
预先感谢
推荐答案
要使用命名的用户帐户,您需要首先指定在您的。
In order to use named user accounts, you need to first specify a list of UserAccount on your CloudPool during creation.
pool.UserAccounts = new List<UserAccount>
{
new UserAccount("myadminaccount", "adminpassword", ElevationLevel.Admin),
new UserAccount("mynonadminaccount", "nonadminpassword", ElevationLevel.NonAdmin),
};
然后您就可以使用 UserIdentity
属性,就像您在示例中一样。
You will then be able to execute tasks assigned to this pool with UserIdentity
properties as you have in your example.
不幸的是,此功能的MSDN文档目前落后,但应尽快更新。
Unfortunately the MSDN documentation for this feature is lagging behind currently, but should be updated soon.
这篇关于Azure Batch-设置任务的自定义用户身份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!