从命令或 API 创建 Azure AD 租户

时间:2021-01-27 17:50:53

标签: azure azure-active-directory

我一直致力于从 Azure Active Directory 中的 API 或命令行创建新租户,但我找不到方法来做到这一点。 我也一直在使用 Azure GraphAPI,但它不支持。

我可以使用命令或 API 的任何方法来自动创建新租户吗?

我研究了 google 和 stackoverflow,但我没有找到任何方法可以从命令或 API 中做到这一点。 微软未来是否有提供此类 API 的计划? (已修改)

1 个答案:

答案 0 :(得分:0)

没有可用的公开、记录或支持(由 MSFT)API。话虽如此,您可以尝试将门户内部 API 与以下内容一起使用:

Invoke-WebRequest -Uri "https://main.iam.ad.ext.azure.com/api/Directories" `
-Method "POST" `
-Headers @{
  "Accept-Language"="en"
  "Authorization"="Bearer <azure ad access token issued for aud=74658136-14ec-4630-ad9b-26e160ff0fc6>"
 } `
-ContentType "application/json" `
-Body "{`"companyName`":`"<company name>`",`"initialDomainPrefix`":`"<initial domain prefix (the one that will be appended to onmicrosoft.com)>`",`"countryCode`":`"<iso (2 letter) country code>`"}"
相关问题