azure-storage-file-share-py

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

31,392 stars
Complexity: easy

About this skill

This skill equips an AI agent with the capability to interact with Azure Storage File Shares, providing robust tools for cloud-native file management. It leverages the Azure Storage File Share SDK for Python, allowing agents to perform operations such as creating, listing, deleting, uploading, and downloading files and directories on SMB file shares in the Azure cloud. This is particularly useful for automating tasks in lift-and-shift scenarios, managing shared storage for cloud applications, and integrating file persistence into AI-driven workflows. The skill supports standard Azure authentication methods, including connection strings and account URLs.

Best use case

Automating file uploads and downloads to Azure File Shares. Managing cloud-based SMB shares for applications or virtual machines. Creating backups or synchronizing data with Azure File Shares. Listing, creating, deleting, and updating files and directories on Azure File Shares programmatically. Integrating secure and scalable cloud file storage into data processing and AI workflows.

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

Successful creation, deletion, or listing of Azure File Shares, directories, and files. Ability to upload content to and download content from specific files on Azure File Shares. Seamless integration of Azure cloud file storage into AI-driven automation workflows. Accurate and secure management of cloud file resources.

Practical example

Example input

Please create a new Azure File Share named 'project-data' and then upload the local file 'config.json' into a directory called 'settings' within that share. After uploading, list all files in the 'settings' directory.

Example output

Successfully created Azure File Share 'project-data'. Directory 'settings' created within 'project-data'. File 'config.json' uploaded to 'settings/config.json'. Files in 'settings' directory: ['config.json'].

When to use this skill

  • When an AI agent needs to perform specific file or directory operations on Azure Storage File Shares.
  • When managing shared storage accessible by multiple cloud services, containers, or virtual machines.
  • For scenarios requiring durable, scalable, and highly available file storage in the Azure ecosystem.
  • When automating data migration, synchronization, or archiving to Azure File Shares.

When not to use this skill

  • For object storage needs (e.g., large unstructured data like images or videos), where Azure Blob Storage might be more appropriate.
  • When local file system operations are sufficient and cloud storage is not required.
  • For highly transactional NoSQL data, where Azure Cosmos DB or similar solutions are a better fit.
  • If the agent only needs to analyze text content *within* a file without needing to manage the file's lifecycle or location.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/azure-storage-file-share-py/SKILL.md --create-dirs "https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/plugins/antigravity-awesome-skills-claude/skills/azure-storage-file-share-py/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/azure-storage-file-share-py/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How azure-storage-file-share-py Compares

Feature / Agentazure-storage-file-share-pyStandard Approach
Platform SupportClaudeLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/A

Frequently Asked Questions

What does this skill do?

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

Which AI agents support this skill?

This skill is designed for Claude.

How difficult is it to install?

The installation complexity is rated as easy. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Azure Storage File Share SDK for Python

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

## Installation

```bash
pip install azure-storage-file-share
```

## Environment Variables

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

## Authentication

### Connection String

```python
from azure.storage.fileshare import ShareServiceClient

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

### Entra ID

```python
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

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

### List Shares

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

### Get Share Client

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

### Delete Share

```python
service.delete_share("my-share")
```

## Directory Operations

### Create Directory

```python
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

```python
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

```python
share_client.delete_directory("my-directory")
```

## File Operations

### Upload File

```python
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

```python
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

```python
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

```python
file_client.delete_file()
```

### Copy File

```python
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

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

### Download Range

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

## Snapshot Operations

### Create Snapshot

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

### Access Snapshot

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

## Async Client

```python
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.

Related Skills

azure-storage-file-share-ts

31392
from sickn33/antigravity-awesome-skills

Azure File Share JavaScript/TypeScript SDK (@azure/storage-file-share) for SMB file share operations.

Cloud Storage ManagementClaude

azure-storage-file-datalake-py

31392
from sickn33/antigravity-awesome-skills

Azure Data Lake Storage Gen2 SDK for Python. Use for hierarchical file systems, big data analytics, and file/directory operations.

Cloud Storage ManagementClaude

azure-storage-blob-ts

31392
from sickn33/antigravity-awesome-skills

Azure Blob Storage JavaScript/TypeScript SDK (@azure/storage-blob) for blob operations. Use for uploading, downloading, listing, and managing blobs and containers.

Cloud Storage ManagementClaude

azure-storage-blob-rust

31392
from sickn33/antigravity-awesome-skills

Azure Blob Storage SDK for Rust. Use for uploading, downloading, and managing blobs and containers.

Cloud Storage ManagementClaude

azure-storage-blob-py

31392
from sickn33/antigravity-awesome-skills

Azure Blob Storage SDK for Python. Use for uploading, downloading, listing blobs, managing containers, and blob lifecycle.

Cloud Storage ManagementClaude

microsoft-azure-webjobs-extensions-authentication-events-dotnet

31392
from sickn33/antigravity-awesome-skills

Microsoft Entra Authentication Events SDK for .NET. Azure Functions triggers for custom authentication extensions.

Identity Management / Authentication & AuthorizationClaude

filesystem-context

31392
from sickn33/antigravity-awesome-skills

Use for file-based context management, dynamic context discovery, and reducing context window bloat. Offload context to files for just-in-time loading.

Memory & Context ManagementClaude

file-path-traversal

31392
from sickn33/antigravity-awesome-skills

Identify and exploit file path traversal (directory traversal) vulnerabilities that allow attackers to read arbitrary files on the server, potentially including sensitive configuration files, credentials, and source code.

Web Security TestingClaude

file-organizer

31392
from sickn33/antigravity-awesome-skills

6. Reduces Clutter: Identifies old files you probably don't need anymore

File ManagementClaude

azure-web-pubsub-ts

31392
from sickn33/antigravity-awesome-skills

Real-time messaging with WebSocket connections and pub/sub patterns.

Messaging & CommunicationClaude

azure-storage-queue-ts

31392
from sickn33/antigravity-awesome-skills

Azure Queue Storage JavaScript/TypeScript SDK (@azure/storage-queue) for message queue operations. Use for sending, receiving, peeking, and deleting messages in queues.

Cloud IntegrationClaude

azure-storage-queue-py

31392
from sickn33/antigravity-awesome-skills

Azure Queue Storage SDK for Python. Use for reliable message queuing, task distribution, and asynchronous processing.

Cloud IntegrationClaude