{"id":1344,"library":"azure-ai-projects","title":"Azure AI Projects Client Library","description":"The Azure AI Projects Client Library for Python provides client access to manage Azure AI Studio resources, including projects, connections, and deployments. It is currently at version 2.0.1 and is actively developed by Microsoft, with regular updates to support new Azure AI Studio features and API versions.","status":"active","version":"2.0.1","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-projects","tags":["azure","microsoft","ai","cloud","projects","sdk","ml","ai-studio"],"install":[{"cmd":"pip install azure-ai-projects azure-identity","lang":"bash","label":"Install core and authentication libraries"}],"dependencies":[{"reason":"Required for authentication with Azure services (e.g., DefaultAzureCredential).","package":"azure-identity","optional":false}],"imports":[{"symbol":"AIStudioClient","correct":"from azure.ai.projects import AIStudioClient"},{"note":"Standard Azure SDK authentication class, common for all Azure services.","symbol":"DefaultAzureCredential","correct":"from azure.identity import DefaultAzureCredential"}],"quickstart":{"code":"import os\nfrom azure.identity import DefaultAzureCredential\nfrom azure.ai.projects import AIStudioClient\n\n# Replace with your Azure Subscription ID and Resource Group Name\nsubscription_id = os.environ.get(\"AZURE_SUBSCRIPTION_ID\", \"YOUR_SUBSCRIPTION_ID\")\nresource_group_name = os.environ.get(\"AZURE_RESOURCE_GROUP\", \"YOUR_RESOURCE_GROUP_NAME\")\nproject_name = os.environ.get(\"AZURE_AI_PROJECT_NAME\", \"my-ai-project\")\n\ntry:\n    # Authenticate using DefaultAzureCredential\n    # This will try various methods: environment variables, managed identity, Azure CLI, etc.\n    credential = DefaultAzureCredential()\n\n    # Create a client for Azure AI Studio Projects\n    client = AIStudioClient(\n        credential=credential,\n        subscription_id=subscription_id,\n        resource_group_name=resource_group_name,\n    )\n\n    # List projects within the specified resource group\n    print(f\"Listing projects in resource group '{resource_group_name}'...\")\n    projects_iterator = client.projects.list(resource_group_name=resource_group_name)\n    for project in projects_iterator:\n        print(f\"- Project Name: {project.name}, Location: {project.location}\")\n\n    # Example: Get a specific project (if it exists)\n    # Make sure 'project_name' exists in your resource group\n    # project = client.projects.get(project_name=project_name)\n    # print(f\"\\nRetrieved project: {project.name}, ID: {project.id}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Please ensure AZURE_SUBSCRIPTION_ID, AZURE_RESOURCE_GROUP, and other necessary credentials are set.\")","lang":"python","description":"This quickstart demonstrates how to authenticate with Azure AI Studio using `DefaultAzureCredential` and list AI projects within a specified resource group. Ensure your environment is configured for Azure authentication (e.g., `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`, or logged in via Azure CLI)."},"warnings":[{"fix":"Refer to the official Azure SDK documentation and samples for version 2.x. Key classes and methods have changed their signatures and object models. Migrate to the new `AIStudioClient` and its associated operations.","message":"Version 2.0.0 introduced significant API changes and a new design for interacting with Azure AI Studio. Code written for 1.x versions will likely require substantial updates.","severity":"breaking","affected_versions":"2.0.0 and later"},{"fix":"Ensure `AZURE_SUBSCRIPTION_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET` environment variables are set, or that you are logged in via `az login` with the Azure CLI. If using Managed Identity, ensure the identity has the necessary roles (e.g., 'Contributor' or specific AI Studio roles).","message":"Authentication requires proper setup for `DefaultAzureCredential`. Without correct environment variables or Azure CLI login, the client will fail to authenticate.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always provide the correct `subscription_id` and `resource_group_name` when initializing the `AIStudioClient`. For operations on specific resources, ensure you pass the correct resource name or ID as arguments.","message":"Operations often require context like `subscription_id` and `resource_group_name` for client initialization, and potentially the specific AI Studio project name for resource-specific actions.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}