通过Power Automate给用户分配license

通过Power automate 给用户分配license

1. Create AAD App Registration
2. Retrieve Token
3. Retrieve licenses list
4. Assign license
5. Remove license

 

首先需要在AAD App Registration中注册新的permission,并且把ID, Secret ID 获取到

 

这里的案例是使用21V系统的API endpoint,你需要根据你的环境找出API endpoint  API endpoints of Office 365 for China | Microsoft Docs

 

在这需要获取access token

client_id=da0443c5-4137-4261-8f1d-85c6fb0b7a71&client_secret=00n0s.uK8_XA6_NhKC8H7_X4h.72tq.BTE&resource=https://microsoftgraph.chinacloudapi.cn&grant_type=client_credentials

 

 

这里需要把返回值转换成JSON格式

复制代码
{
    "type": "object",
    "properties": {
        "token_type": {
            "type": "string"
        },
        "expires_in": {
            "type": "string"
        },
        "ext_expires_in": {
            "type": "string"
        },
        "expires_on": {
            "type": "string"
        },
        "not_before": {
            "type": "string"
        },
        "resource": {
            "type": "string"
        },
        "access_token": {
            "type": "string"
        }
    }
}
复制代码

 

 

 

 

 你也可以通过get请求获取到tenant下的license信息

 

 

 

可以通过POST请求来assign license

复制代码
{
  "addLicenses": [
    {
      "disabledPlans": [  ],
      "skuId": "1e812b99-651f-441b-b352-e7da2d46fc22"
    }
  ],
  "removeLicenses": []
}
复制代码

 

 

 

 Remove license 同样

复制代码
{
  "addLicenses": [
    {
      "disabledPlans": [
        "113feb6c-3fe4-4440-bddc-54d774bf0318"
      ],
      "skuId": "eb4df4a1-51ed-47b3-a544-8be36bd05571"
    }
  ],
  "removeLicenses": [
    "1e812b99-651f-441b-b352-e7da2d46fc22"
  ]
}
复制代码

 

 

posted @   TheMiao  阅读(353)  评论(4编辑  收藏  举报
相关博文:
阅读排行:
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· 【.NET】调用本地 Deepseek 模型
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
· 上周热点回顾(2.17-2.23)
· 如何使用 Uni-app 实现视频聊天(源码,支持安卓、iOS)
点击右上角即可分享
微信分享提示