久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

用于訪(fǎng)問(wèn) Azure Data Lake Store 的 Python 代碼

Python code to access Azure Data Lake Store(用于訪(fǎng)問(wèn) Azure Data Lake Store 的 Python 代碼)
本文介紹了用于訪(fǎng)問(wèn) Azure Data Lake Store 的 Python 代碼的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我正在查看 Microsoft 文檔 這里 和 這里,我在 Azure Active Directory 中創(chuàng)建了 Web 應(yīng)用程序來(lái)訪(fǎng)問(wèn) Data Lake Store

I 'm looking at Microsoft Documentation here and here, I have created Web App in Azure Active Directory to access the Data Lake Store

在 Web 應(yīng)用中,我有 Object IDApplication ID 和 Key

From the Web App I have Object ID, Application ID and Key

查看我看到的文檔:

adlCreds = lib.auth(tenant_id = 'FILL-IN-HERE', client_secret = 'FILL-IN-HERE', client_id = 'FILL-IN-HERE', resource = 'https://datalake.azure.net/')

如何使用它來(lái)驗(yàn)證我的代碼并在 Data Lake Store 上運(yùn)行操作?

how to use it to authenticate my code and run operation on Data Lake Store?

這是我的完整測(cè)試代碼:

here is my full test code:

## Use this for Azure AD authentication
from msrestazure.azure_active_directory import AADTokenCredentials

## Required for Azure Data Lake Store account management
from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient
from azure.mgmt.datalake.store.models import DataLakeStoreAccount

## Required for Azure Data Lake Store filesystem management
from azure.datalake.store import core, lib, multithread

# Common Azure imports
import adal
from azure.mgmt.resource.resources import ResourceManagementClient
from azure.mgmt.resource.resources.models import ResourceGroup

## Use these as needed for your application
import logging, getpass, pprint, uuid, time


## Declare variables
subscriptionId = 'FILL-IN-HERE'
adlsAccountName = 'FILL-IN-HERE'

tenant_id = 'FILL-IN-HERE'
client_secret = 'FILL-IN-HERE'
client_id = 'FILL-IN-HERE'


## adlCreds = lib.auth(tenant_id = 'FILL-IN-HERE', client_secret = 'FILL-IN-HERE', client_id = 'FILL-IN-HERE', resource = 'https://datalake.azure.net/')
from azure.common.credentials import ServicePrincipalCredentials
adlCreds = lib.auth(tenant_id, client_secret, client_id, resource = 'https://datalake.azure.net/')


## Create a filesystem client object
adlsFileSystemClient = core.AzureDLFileSystem(adlCreds, store_name=adlsAccountName)

## Create a directory
adlsFileSystemClient.mkdir('/mysampledirectory')

當(dāng)我嘗試運(yùn)行代碼時(shí),我得到了錯(cuò)誤:

when I try to ru the code I get error:

[運(yùn)行] python "c:....dls.py"回溯(最近一次通話(huà)最后):文件c:....dls.py",第 38 行,在adlCreds = lib.auth(tenant_id, client_secret, client_id, resource = 'https://datalake.azure.net/')文件C:Python36libsite-packagesazuredatalakestorelib.py",第 130 行,身份驗(yàn)證密碼,client_id)文件C:Python36libsite-packagesadalauthentication_context.py",第 145 行,在 acquire_token_with_username_password 中返回 self._acquire_token(token_func)_acquire_token 中的文件C:Python36libsite-packagesadalauthentication_context.py",第 109 行返回 token_func(self)文件C:Python36libsite-packagesadalauthentication_context.py",第 143 行,在 token_func 中return token_request.get_token_with_username_password(用戶(hù)名,密碼)文件C:Python36libsite-packagesadal oken_request.py",第 280 行,在 get_token_with_username_passwordself._user_realm.discover()文件C:Python36libsite-packagesadaluser_realm.py",第 152 行,在發(fā)現(xiàn)中引發(fā) AdalError(return_error_string, error_response)adal.adal_error.AdalError:用戶(hù)領(lǐng)域發(fā)現(xiàn)請(qǐng)求返回 http 錯(cuò)誤:404 和服務(wù)器響應(yīng):

[Running] python "c:....dls.py" Traceback (most recent call last): File "c:....dls.py", line 38, in adlCreds = lib.auth(tenant_id, client_secret, client_id, resource = 'https://datalake.azure.net/') File "C:Python36libsite-packagesazuredatalakestorelib.py", line 130, in auth password, client_id) File "C:Python36libsite-packagesadalauthentication_context.py", line 145, in acquire_token_with_username_password return self._acquire_token(token_func) File "C:Python36libsite-packagesadalauthentication_context.py", line 109, in _acquire_token return token_func(self) File "C:Python36libsite-packagesadalauthentication_context.py", line 143, in token_func return token_request.get_token_with_username_password(username, password) File "C:Python36libsite-packagesadal oken_request.py", line 280, in get_token_with_username_password self._user_realm.discover() File "C:Python36libsite-packagesadaluser_realm.py", line 152, in discover raise AdalError(return_error_string, error_response) adal.adal_error.AdalError: User Realm Discovery request returned http error: 404 and server response:

404 - 找不到文件或目錄.

404 - File or directory not found.

[Done] 在 1.216 秒內(nèi)以 code=1 退出

[Done] exited with code=1 in 1.216 seconds

推薦答案

有兩種不同的身份驗(yàn)證方式.第一個(gè)是交互式的,適合最終用戶(hù).它甚至適用于多因素身份驗(yàn)證.這是你如何做到的.您需要進(jìn)行交互才能登錄.

There are two different ways of authenticating. The first one is interactive which is suitable for end users. It even works with multi factor authentication. Here is how you do it. You need to be interactive in order to log on.

from azure.datalake.store import core, lib, multithread
token = lib.auth()

第二種方法是使用 Azure Active Directory 中的服務(wù)主體標(biāo)識(shí).此處提供了有關(guān)設(shè)置 Azure AD 應(yīng)用程序、檢索客戶(hù)端 ID 和機(jī)密以及使用 SPI 配置訪(fǎng)問(wèn)權(quán)限的分步教程:https://docs.microsoft.com/en-us/azure/data-lake-store/data-lake-store-service-to-service-authenticate-using-active-directory#create-an-active-directory-applicationp>

The second method is to use service principal identities in Azure Active directory. A step by step tutorial for setting up an Azure AD application, retrieving the client id and secret and configuring access using the SPI is available here: https://docs.microsoft.com/en-us/azure/data-lake-store/data-lake-store-service-to-service-authenticate-using-active-directory#create-an-active-directory-application

from azure.common.credentials import ServicePrincipalCredentials
token = lib.auth(tenant_id = '<your azure tenant id>', client_secret = '<your client secret>', client_id = '<your client id>')

這是一篇博文,展示了如何通過(guò) pandas 和 Jupyter 訪(fǎng)問(wèn)它.它還逐步介紹了如何獲取身份驗(yàn)證令牌.https://medium.com/azure-data-lake/using-jupyter-notebooks-and-pandas-with-azure-data-lake-store-48737fbad305

Here is blog post that shows how to access it through pandas and Jupyter. It also has a step by step on how to get the authentication token. https://medium.com/azure-data-lake/using-jupyter-notebooks-and-pandas-with-azure-data-lake-store-48737fbad305

這篇關(guān)于用于訪(fǎng)問(wèn) Azure Data Lake Store 的 Python 代碼的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How should I verify a log message when testing Python code under nose?(在鼻子下測(cè)試 Python 代碼時(shí),我應(yīng)該如何驗(yàn)證日志消息?)
Patch __call__ of a function(修補(bǔ)函數(shù)的 __call__)
How to call self in a mock method of an object in Python?(如何在 Python 中對(duì)象的模擬方法中調(diào)用 self?)
Mocking only a single method on an object(僅模擬對(duì)象上的單個(gè)方法)
Mocking a subprocess call in Python(在 Python 中模擬子進(jìn)程調(diào)用)
Checking call order across multiple mocks(檢查多個(gè)模擬的調(diào)用順序)
主站蜘蛛池模板: 国产成人午夜 | 成人欧美视频 | 夜夜操天天操 | 精品粉嫩小bbwbbwbbw | 亚洲激情欧美 | 久久精品一区二区三区不卡牛牛 | 看黄网站在线观看 | 神马影院午夜伦理片 | 亚洲一区高清 | 三级黄色片网站 | 久久机热这里只有精品 | 亚洲精品在线视频 | 成人免费看片98欧美 | 成人小视频在线观看 | 久久精品久久久久久久 | 91久久久久久久久 | 国产黄色av网站 | 日韩av一级 | www黄色片| 免费一级全黄少妇性色生活片 | 亚洲精品色 | 亚洲色欲色欲www在线观看 | 在线免费观看黄色片 | 久久精品一区二区三区四区五区 | 欧美黄色一区 | 久婷婷 | 国产嫩草视频 | 曰本毛茸茸性生活 | 欧美亚洲一区二区三区 | 久久久www成人免费精品 | 久久久久九九九九 | 国产精品一区二区三区免费 | 日韩一区在线视频 | 亚洲国产区 | 亚洲国产精品久久 | www.第四色| 日韩和的一区二区 | 黄色网址在线播放 | 久久在线免费观看 | 日日干狠狠干 | 日韩一区在线播放 |