from azure.identity import DefaultAzureCredential from azure.mgmt.dns import DnsManagementClient import os AZURE_SUBSCRIPTION_ID = os.environ.get("AZURE_SUBSCRIPTION_ID", None) def get_dns_nameservers(resource_group_name: str, zone_name: str, azure_subscription_id: str | None = None) -> list[str]: try: creds = DefaultAzureCredential() dns_client = DnsManagementClient(creds, azure_subscription_id or AZURE_SUBSCRIPTION_ID) zone = dns_client.zones.get(resource_group_name, zone_name) return zone.name_servers except Exception as e: print(f"Error fetching DNS nameservers: {e}") return []