Registry / azure / azure-mgmt-sqlvirtualmachine

azure-mgmt-sqlvirtualmachine

JSON →
library1.0.0pypypi✓ verified 25d ago

The `azure-mgmt-sqlvirtualmachine` library provides a client for managing Azure SQL Virtual Machines, allowing you to create, update, delete, and list SQL VMs and their associated resources (like SQL VM groups and availability groups). It is currently at version `0.5.0` (as of late 2019) and follows the typical Azure SDK release cadence for management plane libraries, though updates for this specific library have been infrequent.

pip install azure-mgmt-sqlvirtualmachine azure-identity
INSTALL
IMPORT
SIG · AZURE-MGMT-SQLVIRT
A
azure-mgmt-sqlvirtualmachine
azurepythonv1.0.0
Install
3.9s avg
Import
667ms
Disk
44MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.700s · 44.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.9s · import 0.634s · 45MB
44MB installed
● package 44MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SqlVirtualMachineManagementClient
from azure.mgmt.sqlvirtualmachine import SqlVirtualMachineManagementClient
The main client for interacting with SQL Virtual Machine resources.
SqlVirtualMachine
from azure.mgmt.sqlvirtualmachine.models import SqlVirtualMachine
from azure.mgmt.sqlvirtualmachine import SqlVirtualMachine
Model classes for resources and parameters are typically found in the `.models` submodule.
DefaultAzureCredential
from azure.identity import DefaultAzureCredential
Recommended credential provider for authenticating with Azure.

This quickstart demonstrates how to authenticate with Azure using `DefaultAzureCredential` and list all SQL Virtual Machines within a specified subscription. Ensure the `AZURE_SUBSCRIPTION_ID` environment variable is set and your Azure principal has sufficient permissions (e.g., Reader role) to view resources.

import os from azure.identity import DefaultAzureCredential from azure.mgmt.sqlvirtualmachine import SqlVirtualMachineManagementClient # Retrieve subscription ID from environment variable # You can get your subscription ID using Azure CLI: az account show --query id -o tsv subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "YOUR_SUBSCRIPTION_ID") if not subscription_id or subscription_id == "YOUR_SUBSCRIPTION_ID": raise ValueError("Please set the AZURE_SUBSCRIPTION_ID environment variable or replace 'YOUR_SUBSCRIPTION_ID' in the code.") # Authenticate with Azure using DefaultAzureCredential # This will try various authentication methods (environment variables, managed identity, CLI, etc.) credential = DefaultAzureCredential() # Create a SQL Virtual Machine Management Client client = SqlVirtualMachineManagementClient(credential, subscription_id) print(f"Listing SQL Virtual Machines in subscription: {subscription_id}...") try: # Iterate through all SQL Virtual Machines in the subscription sql_vms = client.sql_virtual_machines.list() found_vms = False for vm in sql_vms: found_vms = True print(f" - Name: {vm.name}") print(f" Resource Group: {vm.id.split('/resourceGroups/')[1].split('/')[0]}") print(f" Location: {vm.location}") print(f" Provisioning State: {vm.provisioning_state}") if vm.sql_virtual_machine_group_id: print(f" SQL VM Group ID: {vm.sql_virtual_machine_group_id}") print("-" * 20) if not found_vms: print("No SQL Virtual Machines found in this subscription.") else: print("\nSuccessfully listed SQL Virtual Machines.") except Exception as e: print(f"An error occurred: {e}") print("Ensure AZURE_SUBSCRIPTION_ID is set and your credential has 'Reader' permissions (at least) on the subscription.")
Debug
Known issues
gotchaThe `azure-mgmt-sqlvirtualmachine` library is currently at version `0.5.0`, last updated in October 2019. While still functional, this indicates it uses an older API version and might lack support for newer features or follow an older SDK design pattern compared to more recently updated Azure SDK libraries. Users should verify its capabilities meet their current requirements.
fix
Review the official Azure documentation for SQL Virtual Machines to understand current capabilities and consider if a newer API version or alternative tools (e.g., Azure CLI, REST API) are more appropriate for advanced or recently released features.
affects: <1.0.0
gotchaAuthentication is a common hurdle. All Azure management libraries require proper authentication. Using `DefaultAzureCredential` from `azure-identity` is the recommended and most flexible approach, but it relies on correctly configured environment variables, Azure CLI login, or managed identity.
fix
Ensure `azure-identity` is installed and that your environment variables (e.g., `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`) are set, or you are logged in via Azure CLI (`az login`). Verify the principal has the necessary RBAC permissions (e.g., 'Contributor' or specific resource roles) on the subscription or resource group.
affects: all
gotchaWhen creating or updating resources, ensure that all dependent resources (e.g., Resource Group, Virtual Network, Storage Account) exist and are correctly specified. Misconfigured or missing prerequisites are frequent sources of `ResourceNotFound` or `BadRequest` errors.
fix
Thoroughly review the Azure portal or CLI to confirm all dependent resources are present and correctly configured. Check resource names, IDs, locations, and network settings for accuracy before attempting to deploy or modify SQL Virtual Machines.
affects: all
Upgrade
Version history
1.0.0latest on PyPI · released Jul 20, 2026
Audit
Dependencies
azure-identityrequiredRequired for authentication with Azure services.
Agent activity
30 hits · last 30 days
node
26
Amazon
1
OpenAI (training)
1
Resources