Skip to content

[Feature] Inject Endpoint URL as an Environment Variable #48493

Description

Is your feature request related to a problem? Please describe.
When using a custom cloud, we explicitly have to inject the correct endpoint URL into the Management Clients. This leads to a lot of duplication, and also means awkward if/else statements when we do want to switch back to the Azure Public Cloud.

As an example, this is what the SQL client currently looks like:

base_url: str = "https://management.azure.com",

Which means that an implementation would always have to jump through hoops to configure this:

base_url = "customcloud.company.com"
kwargs = use_custom_cloud() ? {"base_url": base_url} : {}
client = SQLClient(**kwargs)
...

(Our implementation doesn't actually look like this - this is just simplified to make the point.)

Describe the solution you'd like
The ability to set a global environment variable that every client listens to.

AZURE_ENDPOINT_URL=http://customcloud.company.com

The Python clients we can use this if no explicit base_url is configured:

class SqlManagementClientConfiguration
    def __init__(
        ...
        base_url: Optional[str] = None,
    ):
        self.base_url = base_url or os.environ.get("AZURE_ENDPOINT_URL") or "https://management.azure.com"

Metadata

Metadata

Assignees

No one assigned

    Labels

    CodeGenIssues that relate to code generationMgmtThis issue is related to a management-plane library.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-triageWorkflow: This issue needs the team to triage.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions