Azure Batch - Setting custom user identity for tasks

末鹿安然 提交于 2019-12-12 02:25:04

问题


I am using Azure Batch C# Client API 6.1. I am trying to have all my runs using the same user identity.

I am setting a custom user identity as below, as per MSDN documentation.

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.

Would anyone know how to make it work OR even if it is supported by the backend Azure Batch service?

Thanks in advance


回答1:


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),
};

You will then be able to execute tasks assigned to this pool with UserIdentity properties as you have in your example.

Unfortunately the MSDN documentation for this feature is lagging behind currently, but should be updated soon.



来源:https://stackoverflow.com/questions/43384286/azure-batch-setting-custom-user-identity-for-tasks

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!