본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)48k · #3997

azure-storage-file-share-py

하는 일

이 도구로 컴퓨터의 파일 탐색기와 비슷하게 클라우드의 파일과 폴더를 관리할 수 있습니다. 온라인 저장 공간에서 폴더와 파일을 만들고, 목록을 보고, 삭제하고, 이동할 수 있습니다.

사용하는 경우

  • ✓어디서든 중요한 파일을 저장하거나 접근해야 할 때.
  • ✓클라우드에서 많은 파일과 폴더를 정리할 때.
  • ✓통제된 방식으로 다른 사람과 파일을 공유하고 싶을 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-storage-file-share-py/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-storage-file-share-py/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“'documents'라는 폴더를 만들고, 그 안에 'report.txt' 파일을 만들어 주세요. 파일 내용은 '이것은 연간 보고서입니다'입니다.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

액세스 키를 사용해 프로그램을 클라우드 저장 서비스에 연결합니다. 그다음 간단한 명령으로 폴더를 만들고, 파일을 업로드하고 다운로드하며, 저장된 항목을 확인할 수 있습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Azure Storage File Share SDK for Python

Manage SMB file shares for cloud-native and lift-and-shift scenarios.

Installation

pip install azure-storage-file-share

Environment Variables

AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...
# Or
AZURE_STORAGE_ACCOUNT_URL=https://<account>.file.core.windows.net

Authentication

Connection String

from azure.storage.fileshare import ShareServiceClient

service = ShareServiceClient.from_connection_string(
    os.environ["AZURE_STORAGE_CONNECTION_STRING"]
)

Entra ID

from azure.storage.fileshare import ShareServiceClient
from azure.identity import DefaultAzureCredential

service = ShareServiceClient(
    account_url=os.environ["AZURE_STORAGE_ACCOUNT_URL"],
    credential=DefaultAzureCredential()
)

Share Operations

Create Share

share = service.create_share("my-share")

List Shares

for share in service.list_shares():
    print(f"{share.name}: {share.quota} GB")

Get Share Client

share_client = service.get_share_client("my-share")

Delete Share

service.delete_share("my-share")

Directory Operations

Create Directory

share_client = service.get_share_client("my-share")
share_client.create_directory("my-directory")

# Nested directory
share_client.create_directory("my-directory/sub-directory")

List Directories and Files

directory_client = share_client.get_directory_client("my-directory")

for item in directory_client.list_directories_and_files():
    if item["is_directory"]:
        print(f"[DIR] {item['name']}")
    else:
        print(f"[FILE] {item['name']} ({item['size']} bytes)")

Delete Directory

share_client.delete_directory("my-directory")

File Operations

Upload File

file_client = share_client.get_file_client("my-directory/file.txt")

# From string
file_client.upload_file("Hello, World!")

# From file
with open("local-file.txt", "rb") as f:
    file_client.upload_file(f)

# From bytes
file_client.upload_file(b"Binary content")

Download File

file_client = share_client.get_file_client("my-directory/file.txt")

# To bytes
data = file_client.download_file().readall()

# To file
with open("downloaded.txt", "wb") as f:
    data = file_client.download_file()
    data.readinto(f)

# Stream chunks
download = file_client.download_file()
for chunk in download.chunks():
    process(chunk)

Get File Properties

properties = file_client.get_file_properties()
print(f"Size: {properties.size}")
print(f"Content type: {properties.content_settings.content_type}")
print(f"Last modified: {properties.last_modified}")

Delete File

file_client.delete_file()

Copy File

source_url = "https://account.file.core.windows.net/share/source.txt"
dest_client = share_client.get_file_client("destination.txt")
dest_client.start_copy_from_url(source_url)

Range Operations

Upload Range

# Upload to specific range
file_client.upload_range(data=b"content", offset=0, length=7)

Download Range

# Download specific range
download = file_client.download_file(offset=0, length=100)
data = download.readall()

Snapshot Operations

Create Snapshot

snapshot = share_client.create_snapshot()
print(f"Snapshot: {snapshot['snapshot']}")

Access Snapshot

snapshot_client = service.get_share_client(
    "my-share",
    snapshot=snapshot["snapshot"]
)

Async Client

from azure.storage.fileshare.aio import ShareServiceClient
from azure.identity.aio import DefaultAzureCredential

async def upload_file():
    credential = DefaultAzureCredential()
    service = ShareServiceClient(account_url, credential=credential)
    
    share = service.get_share_client("my-share")
    file_client = share.get_file_client("test.txt")
    
    await file_client.upload_file("Hello!")
    
    await service.close()
    await credential.close()

Client Types

Client Purpose
ShareServiceClient Account-level operations
ShareClient Share operations
ShareDirectoryClient Directory operations
ShareFileClient File operations

Best Practices

  1. Use connection string for simplest setup
  2. Use Entra ID for production with RBAC

…

자주 묻는 질문

클라우드 저장소에 어떻게 연결하나요?

모든 접근 정보가 담긴 「연결 문자열」을 사용하거나, 기업에 더 권장되는 Entra ID 보안 시스템을 사용할 수 있습니다.

하위 폴더를 만들 수 있나요?

네, 컴퓨터에서 하는 것처럼 폴더 안에 폴더를 만들 수 있습니다.

프로그램이 멈추지 않도록 큰 파일을 저장하려면 어떻게 하나요?

파일을 한 번에 보내는 대신 조각(청크) 단위로 나누어 보낼 수 있습니다. 이렇게 하면 프로그램이 너무 많은 메모리를 사용하지 않습니다.

상세 정보

작성자의 원본 설명

Azure Storage File Share SDK for Python. Use for SMB file shares, directories, and file operations in the cloud.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#3997
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬