Azure NetApp Files Management Client Library for Python
The `azure-mgmt-netapp` library provides Python APIs for managing Azure NetApp Files resources, including NetApp accounts, capacity pools, and volumes. It allows developers to programmatically interact with the Azure NetApp Files service to automate provisioning, configuration, and monitoring of high-performance file storage. Currently at version 15.0.0, the library is part of the Azure SDK for Python, which follows a continuous release cadence, with regular updates to support new Azure features and improvements.
Warnings
- breaking Version 15.0.0 introduces new hybrid models with dual dictionary and model nature. Existing code interacting with model properties might need updates.
- gotcha Subnets used for Azure NetApp Files volumes must be delegated to `Microsoft.NetApp/volumes`. Failure to do so will result in volume creation errors.
- gotcha The service level of an existing capacity pool cannot be changed if the pool already contains volumes.
- gotcha When using customer-managed keys (CMK) for volume encryption, ensure the Azure Key Vault is in the same region as the NetApp account and configured with appropriate access policies (Get, Encrypt, Decrypt) for the managed identity. The key must be of type RSA, enabled, valid, and active.
Install
-
pip install azure-mgmt-netapp azure-identity
Imports
- NetAppManagementClient
from azure.mgmt.netapp import NetAppManagementClient
- DefaultAzureCredential
from azure.identity import DefaultAzureCredential
Quickstart
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.netapp import NetAppManagementClient
# Set environment variables for authentication and subscription ID
# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET, AZURE_SUBSCRIPTION_ID
subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID", "")
if not subscription_id:
raise ValueError("AZURE_SUBSCRIPTION_ID environment variable not set.")
# Authenticate and create a client
credential = DefaultAzureCredential()
client = NetAppManagementClient(credential=credential, subscription_id=subscription_id)
# Example: List NetApp accounts in your subscription
print("Listing NetApp accounts:")
for account in client.accounts.list():
print(f" Account Name: {account.name}, Location: {account.location}")