azure cli 一键生成 office api 并设置密钥时间

图片[1]-azure cli 一键生成 office api 并设置密钥时间-瑞驰杂刊

账号有 azure 订阅的前往 https://shell.azure.com 登录即可,
没有 azure 订阅的去下载个 azure-cli https://docs.microsoft.com/en-us/cli/azure/install-azure-cli

1. 登录
在 cmd 上输入

az login --allow-no-subscriptions

用  https://shell.azure.com 的可以跳过这步

2. 创建 app

az ad app create --display-name <strong><span style="color: #ff0000;">office</span></strong>-api --end-date 2077-07-07 --password 1234s8yge4se5gh --required-resource-accesses "[{'resourceAccess': [{'id': '19dbc75e-c2e2-444c-a770-ec69d8559fc7','type': 'Role'},{'id': '741f803b-c850-494e-b5df-cde7c675a1ca','type': 'Role'}],'resourceAppId': '00000003-0000-0000-c000-000000000000'}]"

其中,
–display-name 是你的 app 显示名字,
–end-date 是 api 到期时间,格式 YYYY-MM-DD,
–password 是 client secret,这个要记住,
–required-resource-accesses 代表api权限,这里用了 Directory.ReadWrite.All 和 User.ReadWrite.All
输入之后稍等就会返回 api 信息,里面的 appId 就是 client id ,后面要用到,odata.metadata 里面包含了 tenant id
图片[2]-azure cli 一键生成 office api 并设置密钥时间-瑞驰杂刊
[ad]
3. 给予 admin consent

az ad app permission admin-consent --id appId

用上面获得的 appId 替代 –id 内容,office api 即创建和授权成功。

© 版权声明
THE END
扫码关注微信公众号,更多精彩
点赞0打赏 分享
五月 7

本站历史上的今天

    "吼吼~~~,往年的今天站长不知道跑哪里偷懒去了~~~"
评论 共1条
    • 头像跨境电商卖家0