本帖最后由 好鸭 于 2022-4-3 08:43 编辑
我自己找到了,我电脑上 准备 1.下载和安装azure cli: 网址:https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli 直链:https://aka.ms/installazurecliwindows 2:下载之后运行文件安装 azure cli 3.下载并解压manifest:https://files.zorz.cc/manifest.zip 例如解压到 Z:AzClimanifest.json
操作 1.打开 cmd 命令行窗口,输入命令
- Z:
- cd Z:AzCli
- az login –allow-no-subscriptions
复制代码
在打开的浏览器中输入用户名和密码登录 登录成功之后,命令行窗口显示租户相关信息 记录 租户ID: bf7757a1-b331-…………….. "tenantId": "bf7757a1-b331-…………….."
- [{
- "cloudName": "AzureCloud",
- "id": "bf7757a1-b331-……………..",
- "isDefault": true,
- "name": "N/A(tenant level account)",
- "state": "Enabled",
- "tenantId": "bf7757a1-b331-……………..",
- "user": {
- "name": "[email protected]",
- "type": "user"
- }
- }]
复制代码
2.注册应用
- az ad app create –display-name Application –end-date 2099-12-31 –password App1icati0nPa55word –required-resource-accesses @manifest.json
复制代码
- az ad app create –display-name Application –end-date 2299-12-31 –available-to-other-tenants true –password App1icati0nPa55word –required-resource-accesses @manifest.json –reply-urls "https://zfile.jun6.net/onedrive/callback" "https://oneindex.github.io/" "https://pyoneauth.github.io/" "http://localhost/onedrive-login" "https://scfonedrive.github.io" "http://localhost"
复制代码
其中的选项按需修改 –display-name Application –end-date 2099-12-31 –password App1icati0nPa55word 注册成功之后,命令行窗口显示应用相关信息 记录应用程序(客户端) ID: 3eb1d9a8-a9a2-4f18-xxxx-xxxxxxxxxxxx "appId": "3eb1d9a8-a9a2-4f18-xxxx-xxxxxxxxxxxx", 客户端密码为App1icati0nPa55word
- {
- "appId": "3eb1d9a8-a9a2-4f18-xxxx-xxxxxxxxxxxx",
- "displayName": "Application",
- "passwordCredentials": [
- {
- "additionalProperties": null,
- "customKeyIdentifier": null,
- "endDate": "2099-12-31T00:00:00+00:00",
- "keyId": "65466be7-0f12-4f32-8e39-3a22cbe081e7",
- "startDate": "2021-06-05T11:26:52.333549+00:00",
- "value": null
- }],
- "requiredResourceAccess": [
- {
- "additionalProperties": null,
- "resourceAccess": [
- {
- "additionalProperties": null,
- "id": "7dd1be58-6e76-4401-bf8d-31d1e8180d5b",
- "type": "Role"
- },
- }]
- }
复制代码
3.为应用程序授权 上一步生成的应用程序(客户端) ID: 3eb1d9a8-a9a2-4f18-xxxx-xxxxxxxxxxxx
–id appId 3eb1d9a8-a9a2-4f18-xxxx-xxxxxxxxxxxx
- az ad app permission admin-consent –id 3eb1d9a8-a9a2-4f18-xxxx-xxxxxxxxxxxx
复制代码
5.使用应用程序所需的信息如下 租户ID: bf7757a1-b331-…………….. 应用程序客户端 ID: 3eb1d9a8-a9a2-4f18-xxxx-xxxxxxxxxxxx 应用程序客户端密码:App1icati0nPa55word
——————————————————————
ubuntu/debian:
- curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
复制代码
-
- name="Application"
- password="App1icati0nPa55word"
- date="2299-12-31"
- id=`az ad app create –display-name $name –end-date $date –available-to-other-tenants true –password $password –required-resource-accesses @manifest.json –reply-urls "https://zfile.jun6.net/onedrive/callback" "https://oneindex.github.io/" "https://pyoneauth.github.io/" "http://localhost/onedrive-login" "https://scfonedrive.github.io" "http://localhost"` 2>&1|grep appId|cut -d " -f 4
- az ad app permission admin-consent –id $id
- echo "id: $id"
- echo "pwd: $password"
复制代码
官方文档 https://docs.microsoft.com/zh-cn/cli/azure/ad/app?view=azure-cli-latest |