Azure Dev Spaces Management Client Library for Python

0.2.0 · abandoned · verified Sat Apr 11

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

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the Azure Dev Spaces Management Client using `DefaultAzureCredential`. It requires setting Azure Active Directory and subscription ID environment variables for authentication. Due to the retirement of Azure Dev Spaces, actual management operations using this client are expected to fail.

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.")

view raw JSON →