jpskill.com
💼 ビジネス コミュニティ 🟡 少し慣れが必要 👤 経営者・事業責任者・マーケ

💼 AzureStorageファイルSharePy

azure-storage-file-share-py

Microsoft Azureのクラウド上で、Windowsのファイル共有(SMB

⏱ 競合分析レポート 3日 → 半日

📺 まず動画で見る(YouTube)

▶ 【自動化】AIガチ勢の最新活用術6選がこれ1本で丸分かり!【ClaudeCode・AIエージェント・AI経営・Skills・MCP】 ↗

※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。

📜 元の英語説明(参考)

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

🇯🇵 日本人クリエイター向け解説

一言でいうと

Microsoft Azureのクラウド上で、Windowsのファイル共有(SMB

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o azure-storage-file-share-py.zip https://jpskill.com/download/2544.zip && unzip -o azure-storage-file-share-py.zip && rm azure-storage-file-share-py.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/2544.zip -OutFile "$d\azure-storage-file-share-py.zip"; Expand-Archive "$d\azure-storage-file-share-py.zip" -DestinationPath $d -Force; ri "$d\azure-storage-file-share-py.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して azure-storage-file-share-py.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → azure-storage-file-share-py フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

💬 こう話しかけるだけ — サンプルプロンプト

  • Azure Storage File Share Py で、私のビジネスを分析して改善案を3つ提案して
  • Azure Storage File Share Py を使って、来週の会議用の資料を作って
  • Azure Storage File Share Py で、現状の課題を整理してアクションプランに落として

これをClaude Code に貼るだけで、このSkillが自動発動します。

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Python 用 Azure Storage File Share SDK

クラウドネイティブおよびリフト&シフトのシナリオ向けに SMB ファイル共有を管理します。

インストール

pip install azure-storage-file-share

環境変数

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

認証

接続文字列

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 = service.create_share("my-share")

共有のリスト表示

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

共有クライアントの取得

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

共有の削除

service.delete_share("my-share")

ディレクトリ操作

ディレクトリの作成

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

# ネストされたディレクトリ
share_client.create_directory("my-directory/sub-directory")

ディレクトリとファイルのリスト表示

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)")

ディレクトリの削除

share_client.delete_directory("my-directory")

ファイル操作

ファイルのアップロード

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

# 文字列から
file_client.upload_file("Hello, World!")

# ファイルから
with open("local-file.txt", "rb") as f:
    file_client.upload_file(f)

# バイトから
file_client.upload_file(b"Binary content")

ファイルのダウンロード

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

# バイトへ
data = file_client.download_file().readall()

# ファイルへ
with open("downloaded.txt", "wb") as f:
    data = file_client.download_file()
    data.readinto(f)

# チャンクをストリーム
download = file_client.download_file()
for chunk in download.chunks():
    process(chunk)

ファイルプロパティの取得

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}")

ファイルの削除

file_client.delete_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)

範囲操作

範囲のアップロード

# 特定の範囲にアップロード
file_client.upload_range(data=b"content", offset=0, length=7)

範囲のダウンロード

# 特定の範囲をダウンロード
download = file_client.download_file(offset=0, length=100)
data = download.readall()

スナップショット操作

スナップショットの作成

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

スナップショットへのアクセス

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

非同期クライアント

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()

クライアントの種類

クライアント 目的
ShareServiceClient アカウントレベルの操作
ShareClient 共有操作
ShareDirectoryClient ディレクトリ操作
ShareFileClient ファイル操作

ベストプラクティス

  1. 接続文字列を使用することで最も簡単なセットアップが可能です。
  2. Entra ID を使用することで RBAC を用いた本番環境に対応できます。
  3. 大きなファイルをストリームする際は chunks() を使用してメモリの問題を回避してください。
  4. 主要な変更を行う前にスナップショットを作成することをお勧めします。
  5. クォータを設定することで予期せぬストレージコストを防ぎます。
  6. 範囲を使用することで部分的なファイル更新が可能です。
  7. 非同期クライアントを明示的に閉じるようにしてください。

使用するタイミング

このスキルは、概要に記載されているワークフローやアクションを実行する際に適用できます。

制限事項

  • このスキルは、タスクが上記の範囲と明確に一致する場合にのみ使用してください。
  • 出力を、環境固有の検証、テスト、または専門家によるレビューの代わりとして扱わないでください。
  • 必要な入力、アクセス許可、安全境界、または成功基準が不足している場合は、停止して明確化を求めてください。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

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
  3. Stream large files using chunks() to avoid memory issues
  4. Create snapshots before major changes
  5. Set quotas to prevent unexpected storage costs
  6. Use ranges for partial file updates
  7. Close async clients explicitly

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.