You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否通过自动化ARM模板创建可登录Azure门户的Azure AD用户?求最简代码

能否用ARM模板创建带密码的Azure AD用户?

可以通过ARM模板创建支持登录Azure门户的Azure AD用户账户(带密码),以下是实现该需求的最简ARM模板代码:

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "resources": [
    {
      "type": "Microsoft.AzureAD/users",
      "apiVersion": "2020-01-01",
      "name": "[guid(resourceGroup().id)]",
      "properties": {
        "accountEnabled": true,
        "displayName": "John Doe",
        "mailNickname": "johndoe",
        "userPrincipalName": "johndoe@yourdomain.onmicrosoft.com",
        "passwordProfile": {
          "password": "P@ssw0rd123!",
          "forceChangePasswordNextLogin": true
        }
      }
    }
  ]
}

关键说明:

  • userPrincipalName 必须是租户内有效的格式,通常为用户名@租户域名
  • password 需符合Azure AD的密码复杂度要求
  • forceChangePasswordNextLogin 设置为true时,用户首次登录门户必须修改密码,这是安全最佳实践
  • 部署该模板的账号需要拥有Azure AD的用户管理员或全局管理员权限

内容的提问来源于stack exchange,提问作者CodeMed

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 20:35:59