Azure Dev Spaces Management Client Library for Python
This library provides the Python client for managing Microsoft Azure Dev Spaces. Azure Dev Spaces was a development tool for Kubernetes, but the service has been retired as of May 15, 2021. This library, version 0.2.0, was last released in May 2019 and is no longer actively maintained, reflecting the retirement of the underlying service.
Warnings
- breaking The underlying Azure Dev Spaces service was retired on May 15, 2021. Consequently, this management library is for a defunct service and attempting to manage Dev Spaces resources will result in errors as the service no longer functions.
- gotcha This library is very old (v0.2.0, last released May 2019) and has not received updates since the retirement of the Azure Dev Spaces service. It may not be fully compatible with newer Python versions (e.g., Python 3.8+ for which many newer Azure SDKs are built) or the latest Azure SDK guidelines and features.
- deprecated Azure Dev Spaces, and by extension this management library, has been fully retired. Microsoft recommends transitioning to Bridge to Kubernetes for similar development scenarios.
Install
-
pip install azure-mgmt-devspaces azure-identity
Imports
- DevSpacesManagementClient
from azure.mgmt.devspaces import DevSpacesManagementClient
- DefaultAzureCredential
from azure.identity import DefaultAzureCredential
Quickstart
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.devspaces import DevSpacesManagementClient
# NOTE: Azure Dev Spaces service was retired on May 15, 2021.
# This code will connect to the management plane, but operations
# related to Dev Spaces resources will likely fail as the service is defunct.
# Set environment variables for authentication and subscription ID:
# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
# AZURE_SUBSCRIPTION_ID
try:
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "") # Replace with your actual subscription ID or set environment variable
if not subscription_id:
raise ValueError("AZURE_SUBSCRIPTION_ID environment variable not set.")
# Authenticate using DefaultAzureCredential
credential = DefaultAzureCredential()
# Create a Dev Spaces Management Client
client = DevSpacesManagementClient(credential=credential, subscription_id=subscription_id)
print(f"Successfully created Azure Dev Spaces Management Client for subscription: {subscription_id}")
# Example of a client operation (will likely fail due to service retirement):
# You would typically list or manage Dev Spaces resources here.
# For instance:
# print("Attempting to list operations (will likely fail for retired service)...")
# operations = client.operations.list()
# for op in operations:
# print(op.name)
except Exception as e:
print(f"An error occurred: {e}")
print("Ensure AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET, and AZURE_SUBSCRIPTION_ID are set.")