Accessing Azure Files
Azure Files provides fully managed cloud file shares that are accessible via the industry-standard Server Message Block (SMB) protocol and Network File System (NFS) protocol. This means you can "lift and shift" legacy applications that rely on file shares to Azure without significant code changes.
Key Access Methods
There are several ways to access your Azure File shares:
1. Mounting with SMB
Mounting your Azure File share using SMB is the most common method, especially for Windows environments. You can mount the share directly onto your client machines or servers.
Mounting on Windows
Open PowerShell or Command Prompt as an administrator and use the net use command:
net use Z: \\.file.core.windows.net\ /u:
Replace <storage-account-name>, <share-name>, and <storage-account-key> with your actual values.
Mounting on Linux
Install the cifs-utils package if you haven't already, then use the mount command:
sudo mount -t cifs \\\\<storage-account-name>.file.core.windows.net\\<share-name> /mnt/ -o vers=3.0,username=<storage-account-name>,password=<storage-account-key>,dir_mode=0777,file_mode=0777,serverino
Make sure to create the /mnt/<mount-point> directory first.
Mounting on macOS
Use the mount command in Terminal:
open smb://.file.core.windows.net/
You will be prompted for your storage account name and access key.
2. Mounting with NFS (Preview)
For Linux-based workloads that prefer NFS, Azure Files offers NFS v3.0 support. This provides a familiar file-sharing experience for Linux applications.
Prerequisites for NFS
- The file share must be created with the NFS protocol enabled.
- Network connectivity from your client to the Azure Files endpoint.
Mounting with NFS
sudo mount -t nfs -o sec=sys,vers=3,anon= .file.core.windows.net:// /nfs/mount/point
Replace <uid> with the UID of the user that should own the files on the mounted share. The /nfs/mount/point must be an existing directory on your client.
3. Using Azure File Sync
Azure File Sync is a service that allows you to centralize your organization's file shares in Azure Files, while keeping the flexibility, performance, and compatibility of an on-premises file server. It syncs multiple Azure file shares to a central location.
4. Accessing via REST API
You can interact with Azure Files programmatically using the Azure Storage REST API. This allows you to manage shares, upload/download files, and perform other operations from your applications.
To access files via REST, you'll typically use Shared Access Signatures (SAS) or account keys for authentication.
Authentication and Authorization
Azure Files offers several authentication methods:
- Storage Account Keys: The simplest form of authentication, suitable for development and testing.
- Shared Access Signatures (SAS): Granting time-limited, granular access to specific resources.
- Azure Active Directory (Azure AD) Domain Services: For Kerberos authentication with SMB, enabling identity-based access control.
Consider your security requirements when choosing an authentication method. Azure AD integration provides the most robust identity management.
Get Started with Azure Files