访问令牌 [英] access token

查看:110
本文介绍了访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在adls gen2中创建文件系统我找到了这个命令

i want to create filesystem in adls gen2 the i found this command

url -i -X PUT -H" x-ms-version:2018-11- 09" -H"content-length:0" -H"授权:Bearer $ ACCESS_TOKEN" "https://$STORAGE_ACCOUNT_NAME.dfs.core.windows.net/mydata?resource = filesystem"

url -i -X PUT -H "x-ms-version: 2018-11-09" -H "content-length: 0" -H "Authorization: Bearer $ACCESS_TOKEN" "https://$STORAGE_ACCOUNT_NAME.dfs.core.windows.net/mydata?resource=filesystem"

请告诉我如何通过powershell创建访问令牌

plz tell me how to create it access token through powershell

我是azure的新手

推荐答案

您好Rohit,

Hi Rohit,

自从您是Azure新手,这里是一个分步指南,供您使用REST API使用ADLS Gen2。

Since you are new to Azure, here's a step by step guide for you to use ADLS Gen2 using REST APIs.


要使用ADLS Gen2的REST API,您需要授权标题。该URL也直接具有SAS令牌(不作为参数)。 

To use the REST APIs of ADLS Gen2, you need authorization header as well. Also the URL has SAS token directly(not as a parameter). 


使用ADLS Gen2 API(使用OAuth2)创建文件的简单方法be:

A simple way to use ADLS Gen2 APIs (Using OAuth2) to create a file would be :


1.通过向 https://login.microsoftonline .com /< tenant
id> /oauth2/v2.0/token


标题:


" Content-Type:application / x-www-form-urlencoded"

"Content-Type: application/x-www-form-urlencoded"


Body: 

Body : 


{" client_id":< CLIENT_ID>,

{"client_id": <CLIENT_ID>,


" client_secret":< CLIENT_SECRET>,

"client_secret": <CLIENT_SECRET>,


" scope":" https://storage.azure.com/.default" ;,


" grant_type":" client_credentials"


}


2.通过向  https://<存储帐户名称> .dfs.core.windows.net /<文件系统名称>?发送PUT请求来创建文件系统resource = filesystem

2. Create a file system by making a PUT request to https://<storage account name>.dfs.core.windows.net/<file system name>?resource=filesystem


标题:


Content-Length:0


" x-ms-version":" 2018-11-09"

"x-ms-version":"2018-11-09"


授权:Bearer< access_token from step1>


3.通过向   https://< storage account name> .dfs.core.windows.net /< ;;执行PATCH请求,在根目录上设置默认权限文件系统名称>?action = setAccessControl

3. Set default permissions on the root directory by making a PATCH request to  https://<storage account name>.dfs.core.windows.net/<file system name>?action=setAccessControl


标题:


Content-Length:0


" x-ms-version":" 2018-11-09"

"x-ms-version":"2018-11-09"


授权:Bearer< access_token from step1>


x-ms-acl:
用户:: RWX,组:: RX,其他:: - X,缺省用户:: RWX,缺省组:: RX,默认:其他:: -


4.
通过向https://<存储帐户名称> .dfs.core.windows.net /<存储PUT请求创建目录文件系统名称> /<目录名称>?resource =目录

4. Create a directory by making a PUT request to https://<storage account name>.dfs.core.windows.net/<file system name>/<directory name>?resource=directory


标题:


Content-Length:0


" x-ms-version":" 2018-11-09"

"x-ms-version":"2018-11-09"


授权:Bearer< access_token from step1>


5.通过发出PUT请求来创建文件 https://< storage
account name> .dfs.core.windows.net /< file系统名称> /<目录名称> /< file
name>?resource = file

5. Create a file by making a PUT request tohttps://<storage account name>.dfs.core.windows.net/<file system name>/<directory name>/<file name>?resource=file


标题:


Content-Length:0


" x-ms-version":" 2018-11-09"

"x-ms-version":"2018-11-09"


授权:Bearer< access_token from step1>


希望这会有所帮助。

Hope this helps.



这篇关于访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆