我知道有一个 Azure 门户可以管理组、用户等。
是否有任何方法可以以编程方式执行此操作(使用 web-api 或 C# 中的 sdk)?
提前致谢。
最佳答案
使用 Microsoft Graph REST 可以轻松创建 Azure AD 用户。下面是一个代码示例供您引用:
POST https://graph.microsoft.com/v1.0/users
Authorization: Bearer {token}
Content-type: application/json
{
"accountEnabled": true,
"displayName": "displayName-value",
"mailNickname": "mailNickname-value",
"userPrincipalName": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="86f3f6e8abf0e7eaf3e3c6f2e3e8e7e8f2abf0e7eaf3e3a8e9e8ebefe5f4e9f5e9e0f2a8e5e9eb" rel="noreferrer noopener nofollow">[email protected]</a>",
"passwordProfile" : {
"forceChangePasswordNextSignIn": true,
"password": "password-value"
}
}
它还提供了使用 C# 的相应库,来自 here 。有关Microsoft Graph的更多详细信息,您可以引用以下链接:
关于c# - 如何以编程方式创建 Azure AD 用户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44756742/