gpt4 book ai didi

azure - 将哪个 IP 添加到 azure 防火墙以将文件从本地系统上传到 adls?

转载 作者:行者123 更新时间:2023-12-03 03:34:05 25 4
gpt4 key购买 nike

我正在尝试将文件从本地系统上传到 adls。下面是要上传的代码:

import os, uuid, sys
from azure.storage.filedatalake import DataLakeServiceClient
from azure.core._match_conditions import MatchConditions
from azure.storage.filedatalake._models import ContentSettings
from azure.identity import ClientSecretCredential

client_secret = <client_secret>
client_id = <client_id>
tenant_id = <tenant_id>
file_system = "fs-adls"
storage_account_name = "sgprod"
directory = "e2e"
file_name = "abc.py"

credential = ClientSecretCredential(tenant_id, client_id, client_secret)
service_client = DataLakeServiceClient(account_url="{}://{}.dfs.core.windows.net".format("https", storage_account_name), credential=credential)
file_system_client = service_client.get_file_system_client(file_system=file_system)
dest_directory_client = file_system_client.get_directory_client(directory)
f = open("run/abc.py",'r')
dest_file_client = dest_directory_client.create_file(file_name)
file_contents = f.read()
dest_file_client.upload_data(file_contents, overwrite=True)
f.close()

当我尝试在本地 conda 环境中运行上述代码时,出现以下错误:

azure.core.exceptions.HttpResponseError: (AuthorizationFailure) This request is not authorized to perform this operation.
RequestId:699c1c01-901f-002a-1a5b-d9553a000000
Time:2022-10-06T08:16:24.7267071Z
Code: AuthorizationFailure
Message: This request is not authorized to perform this operation.
RequestId:699c1c01-901f-002a-1a5b-d9553a000000
Time:2022-10-06T08:16:24.7267071Z

我认为问题出在 IP 地址上,我的本地系统的 IP 地址需要首先列入白名单(即应将其添加到 Azure 防火墙)。是需要添加到 Azure 防火墙的网络 IP 还是客户端 IP?在哪里可以找到它?

最佳答案

只需谷歌“我的 IP 是什么?”它会告诉你哪个IP被列入白名单。只需将该 IP 添加到 ADLS 的 Azure 防火墙

关于azure - 将哪个 IP 添加到 azure 防火墙以将文件从本地系统上传到 adls?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73970722/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com