Azure File Share for Python
Guides Python developers through secure Azure SMB share, directory, and file management.
The evidence prioritizes DefaultAzureCredential, Microsoft Entra ID, and RBAC while discouraging connection strings and API keys. However, cloud-side create, delete, upload, and copy operations lack user-confirmation guidance, explicit least-privilege requirements, and a concrete rollback procedure; sensitive-data handling is also limited, so points are deducted.
The material covers sync/async clients, lifecycle management, range operations, and some production recommendations. However, examples omit an explicit os import, leave account_url undefined in the async example, and provide little concrete retry, paging, concurrency, exception-feedback, or executable-test evidence. Static calibration limits this to 10 or below.
Trigger terms, the Python SDK target, SMB file-share scope, and primary scenarios are clear, with both sync and async forms documented. Non-fit boundaries, input constraints, prerequisite permissions, regional reachability, and Chinese-language usage are not specified, so points are deducted.
The skill has a stable name and description, MIT licensing, a version field, installation notes, layered reference files, and repository-level maintenance context. It lacks a changelog, clearly assigned maintenance/update path, pinned dependency guidance, FAQ coverage, and systematic troubleshooting, so it is not full marks.
It can directly guide common share, directory, file, range, and snapshot SDK tasks, and most snippets are useful starting points. Some code is not immediately runnable and production initialization, permissions, failure recovery, and validation are incomplete; substantial review remains necessary, so static calibration limits this to 7 or below.
The skill provides concrete code, reference files, and named API methods, while repository context shows CI, evaluation workflows, and a test harness. There is no skill-specific committed test suite or third-party execution evidence, so key API correctness cannot be independently reproduced from the supplied static material; static calibration limits this to 5 or below.
- Deleting shares, directories, and files can cause irreversible or high-impact cloud-side effects; the examples do not require confirmation or provide a general recovery workflow.
- The sync example omits the os import, and the async example leaves account_url undefined, so copied snippets are not guaranteed to run directly.
- Before production use, verify the current SDK API, RBAC permissions, retry behavior, paging, timeouts, overwrite semantics, and regional network reachability.
What it does & when to use it
This skill targets developers using the Azure Storage File Share SDK for Python to manage SMB file shares in cloud-native and lift-and-shift scenarios. It covers share lifecycle operations, directory management, file transfers and properties, range access, copying, and snapshots. The guidance favors DefaultAzureCredential with Microsoft Entra ID and requires deterministic client cleanup through context managers. It is a focused coding aid for Azure File Share integrations rather than a general Azure Storage guide.
Shows how to install azure-storage-file-share and configure AZURE_STORAGE_ACCOUNT_URL plus the optional AZURE_TOKEN_CREDENTIALS setting; use ShareServiceClient, ShareClient, ShareDirectoryClient, and ShareFileClient; create, list, retrieve, and delete shares and directories; upload, download, inspect, delete, and copy files; perform ranged uploads and downloads; create and access share snapshots; and write equivalent synchronous and asynchronous client code with appropriate credential and transport lifecycle management.
- A Python developer needs to provision, enumerate, or remove Azure SMB file shares.
- An application needs to create nested directories and enumerate directories and files within a share.
- A migration or business application must upload strings, bytes, or local files and download content to memory or disk.
- A large-file workflow needs chunked streaming or partial range reads and writes.
- A maintenance workflow should create a share snapshot before making major changes.
- A team wants portable local-development and Azure authentication through DefaultAzureCredential and Microsoft Entra ID.
Pros & cons
- Covers core share, directory, file, range, and snapshot workflows.
- Includes both synchronous and asynchronous Python examples.
- Provides explicit guidance for DefaultAzureCredential, Microsoft Entra ID, RBAC-oriented production authentication, and context-managed cleanup.
- Addresses streaming, quotas, snapshots, and partial file operations.
- Requires an Azure File Share account URL and a working authentication setup.
- Does not specify the exact Microsoft Entra RBAC roles or permissions required.
- The supplied material provides no independent test evidence for this specific skill.
- Its scope is Azure Storage File Share; sibling storage skills and their capabilities should not be assumed to be included.
How to install
Install the collection with npx skills add microsoft/skills and select the skill in the wizard. The collection installs skills into the selected agent directory, such as .github/skills/ for GitHub Copilot. Install the Python SDK with pip install azure-storage-file-share. For Entra ID authentication, set AZURE_STORAGE_ACCOUNT_URL=https://<account>.file.core.windows.net; when using DefaultAzureCredential in production, set AZURE_TOKEN_CREDENTIALS=prod. The supplied material does not document the exact Azure permission assignments.
How to use
A suitable trigger prompt is: "Use azure-storage-file-share and ShareServiceClient to create an Azure file share and upload a file in Python." Use ShareServiceClient, ShareClient, ShareDirectoryClient, or ShareFileClient for the relevant operation. Wrap synchronous clients in with and asynchronous clients, including azure.identity.aio.DefaultAzureCredential, in async with. Prefer DefaultAzureCredential in production and keep synchronous and asynchronous client types consistent within a call path.