yera.cli.setup_handlers.azure

Azure OpenAI provider setup handler.

Symbols

class AzureSetup — Handler for configuring Azure OpenAI provider connections.

AzureSetup

Handler for configuring Azure OpenAI provider connections.

This class provides mechanisms to automatically discover Azure OpenAI resources across all accessible subscriptions or to manually configure a specific connection via user input.

Methods

detect_config — Attempts to automatically detect Azure OpenAI configuration.
ask_for_config — Interactively prompts the user for Azure OpenAI connection details.
validate — Validates the Azure connection by attempting to acquire an AD token.

AzureSetup.detect_config

detect_config() → AzureConnection | None

Attempts to automatically detect Azure OpenAI configuration.

Uses the Azure SDK to discover all OpenAI accounts the current authenticated identity has access to. If multiple are found, it prompts the user to select one.

Returns

type: AzureConnection | None

An AzureConnection instance if a resource is successfully discovered and selected; otherwise, None.

AzureSetup.ask_for_config

ask_for_config() → AzureConnection | None

Interactively prompts the user for Azure OpenAI connection details.

Collects required metadata including the endpoint, resource name, subscription ID, tenant ID, and resource group.

Returns

type: AzureConnection | None

An AzureConnection instance containing the user-provided details, or None if the user declines the setup.

AzureSetup.validate

validate(
    config: AzureConnection,
) → None

Validates the Azure connection by attempting to acquire an AD token.

This method verifies that the provided tenant ID is valid and that the current environment identity has permission to request a token for the Cognitive Services scope.

Parameters

config
type: AzureConnection

The Azure connection configuration to validate.

Raises

ValueError

If a token cannot be acquired for the specified tenant.