{
  "schema": "https://ai-atoms.com/schemas/skill-v1.json",
  "type": "skill",
  "id": "skill/azure-storage-file-share-py",
  "version": "1.0.1",
  "name": "Azure Storage File Share Py",
  "description": "Azure Storage File Share SDK for Python. Use for SMB file shares, directories, and file operations in the cloud.\nTriggers: \"azure-storage-file-share\", \"ShareServiceClient\", \"ShareClient\", \"file share\", \"SMB\".",
  "system_prompt_fragment": "# Azure Storage File Share SDK for Python\n\nManage SMB file shares for cloud-native and lift-and-shift scenarios.\n\n## Installation\n\n```bash\npip install azure-storage-file-share\n```\n\n## Environment Variables\n\n```bash\nAZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...\n# Or\nAZURE_STORAGE_ACCOUNT_URL=https://<account>.file.core.windows.net\n```\n\n## Authentication\n\n### Connection String\n\n```python\nfrom azure.storage.fileshare import ShareServiceClient\n\nservice = ShareServiceClient.from_connection_string(\n    os.environ[\"AZURE_STORAGE_CONNECTION_STRING\"]\n)\n```\n\n### Entra ID\n\n```python\nfrom azure.storage.fileshare import ShareServiceClient\nfrom azure.identity import DefaultAzureCredential\n\nservice = ShareServiceClient(\n    account_url=os.environ[\"AZURE_STORAGE_ACCOUNT_URL\"],\n    credential=DefaultAzureCredential()\n)\n```\n\n## Share Operations\n\n### Create Share\n\n```python\nshare = service.create_share(\"my-share\")\n```\n\n### List Shares\n\n```python\nfor share in service.list_shares():\n    print(f\"{share.name}: {share.quota} GB\")\n```\n\n### Get Share Client\n\n```python\nshare_client = service.get_share_client(\"my-share\")\n```\n\n### Delete Share\n\n```python\nservice.delete_share(\"my-share\")\n```\n\n## Directory Operations\n\n### Create Directory\n\n```python\nshare_client = service.get_share_client(\"my-share\")\nshare_client.create_directory(\"my-directory\")\n\n# Nested directory\nshare_client.create_directory(\"my-directory/sub-directory\")\n```\n\n### List Directories and Files\n\n```python\ndirectory_client = share_client.get_directory_client(\"my-directory\")\n\nfor item in directory_client.list_directories_and_files():\n    if item[\"is_directory\"]:\n        print(f\"[DIR] {item['name']}\")\n    else:\n        print(f\"[FILE] {item['name']} ({item['size']} bytes)\")\n```\n\n### Delete Directory\n\n```python\nshare_client.delete_directory(\"my-directory\")\n```\n\n## File Operations\n\n### Upload File\n\n```python\nfile_client = share_client.get_file_client(\"my-directory/file.txt\")\n\n# From string\nfile_client.upload_file(\"Hello, World!\")\n\n# From file\nwith open(\"local-file.txt\", \"rb\") as f:\n    file_client.upload_file(f)\n\n# From bytes\nfile_client.upload_file(b\"Binary content\")\n```\n\n### Download File\n\n```python\nfile_client = share_client.get_file_client(\"my-directory/file.txt\")\n\n# To bytes\ndata = file_client.download_file().readall()\n\n# To file\nwith open(\"downloaded.txt\", \"wb\") as f:\n    data = file_client.download_file()\n    data.readinto(f)\n\n# Stream chunks\ndownload = file_client.download_file()\nfor chunk in download.chunks():\n    process(chunk)\n```\n\n### Get File Properties\n\n```python\nproperties = file_client.get_file_properties()\nprint(f\"Size: {properties.size}\")\nprint(f\"Content type: {properties.content_settings.content_type}\")\nprint(f\"Last modified: {properties.last_modified}\")\n```\n\n### Delete File\n\n```python\nfile_client.delete_file()\n```\n\n### Copy File\n\n```python\nsource_url = \"https://account.file.core.windows.net/share/source.txt\"\ndest_client = share_client.get_file_client(\"destination.txt\")\ndest_client.start_copy_from_url(source_url)\n```\n\n## Range Operations\n\n### Upload Range\n\n```python\n# Upload to specific range\nfile_client.upload_range(data=b\"content\", offset=0, length=7)\n```\n\n### Download Range\n\n```python\n# Download specific range\ndownload = file_client.download_file(offset=0, length=100)\ndata = download.readall()\n```\n\n## Snapshot Operations\n\n### Create Snapshot\n\n```python\nsnapshot = share_client.create_snapshot()\nprint(f\"Snapshot: {snapshot['snapshot']}\")\n```\n\n### Access Snapshot\n\n```python\nsnapshot_client = service.get_share_client(\n    \"my-share\",\n    snapshot=snapshot[\"snapshot\"]\n)\n```\n\n## Async Client\n\n```python\nfrom azure.storage.fileshare.aio import ShareServiceClient\nfrom azure.identity.aio import DefaultAzureCredential\n\nasync def upload_file():\n    credential = DefaultAzureCredential()\n    service = ShareServiceClient(account_url, credential=credential)\n    \n    share = service.get_share_client(\"my-share\")\n    file_client = share.get_file_client(\"test.txt\")\n    \n    await file_client.upload_file(\"Hello!\")\n    \n    await service.close()\n    await credential.close()\n```\n\n## Client Types\n\n| Client | Purpose |\n|--------|---------|\n| `ShareServiceClient` | Account-level operations |\n| `ShareClient` | Share operations |\n| `ShareDirectoryClient` | Directory operations |\n| `ShareFileClient` | File operations |\n\n## Best Practices\n\n1. **Use connection string** for simplest setup\n2. **Use Entra ID** for production with RBAC\n3. **Stream large files** using chunks() to avoid memory issues\n4. **Create snapshots** before major changes\n5. **Set quotas** to prevent unexpected storage costs\n6. **Use ranges** for partial file updates\n7. **Close async clients** explicitly\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.",
  "applicable_domains": [
    "devops"
  ],
  "category": "devops",
  "invocation": [
    "/azure-storage-file-share-py"
  ],
  "authored_by": "claudeskills.in community",
  "source_url": "https://claudeskills.in/skill/azure-storage-file-share-py",
  "provenance": {
    "source": "claudeskills.in",
    "source_url": "https://claudeskills.in/skill/azure-storage-file-share-py",
    "license": "unknown",
    "imported_at": "2026-09-03",
    "notes": "Aggregated by claudeskills.in from community GitHub lists."
  },
  "tags": [
    "claudeskills",
    "devops"
  ],
  "lifecycle": "draft"
}