azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Add Azure Service Fabrik Cluster Endpoint to `az cloud show` command

Open s4heid opened this issue 1 year ago • 2 comments

Related command The objective is to enhance the functionality of the az cloud show command by adding the suffix of the Azure Service Fabric cluster to its output.

Is your feature request related to a problem? Please describe.

This enhancement would be especially beneficial for tasks like scripting the association of reverse DNS entries to public IP addresses across different Azure clouds or other automation tasks, where you need to know the suffix of the Azure Service Fabrik Cluster.

The current output of az cloud show doesn't provide this detail, which limits its utility in certain automation scenarios. By making this change, we could streamline processes and improve efficiency in managing Azure resources.

Describe the solution you'd like

It would be helpful if the az cloud show command could display the suffix of the Azure Service Fabric cluster.

Expected Output for public Cloud:

Command

❯ az cloud show -n AzureCloud

Output

{
  "endpoints": {
    "activeDirectory": "https://login.microsoftonline.com",
    "activeDirectoryDataLakeResourceId": "https://datalake.azure.net/",
    "activeDirectoryGraphResourceId": "https://graph.windows.net/",
    "activeDirectoryResourceId": "https://management.core.windows.net/",
    "appInsightsResourceId": "https://api.applicationinsights.io",
    "appInsightsTelemetryChannelResourceId": "https://dc.applicationinsights.azure.com/v2/track",
    "attestationResourceId": "https://attest.azure.net",
    "azmirrorStorageAccountResourceId": null,
    "batchResourceId": "https://batch.core.windows.net/",
    "gallery": "https://gallery.azure.com/",
    "logAnalyticsResourceId": "https://api.loganalytics.io",
    "management": "https://management.core.windows.net/",
    "mediaResourceId": "https://rest.media.azure.net",
    "microsoftGraphResourceId": "https://graph.microsoft.com/",
    "ossrdbmsResourceId": "https://ossrdbms-aad.database.windows.net",
    "portal": "https://portal.azure.com",
    "resourceManager": "https://management.azure.com/",
    "sqlManagement": "https://management.core.windows.net:8443/",
    "synapseAnalyticsResourceId": "https://dev.azuresynapse.net",
    "vmImageAliasDoc": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/arm-compute/quickstart-templates/aliases.json"
  },
  "isActive": true,
  "name": "AzureCloud",
  "profile": "latest",
  "suffixes": {
    "acrLoginServerEndpoint": ".azurecr.io",
+   "acrServiceFabrikEndpoint": ".cloudapp.azure.com",
    "attestationEndpoint": ".attest.azure.net",
    "azureDatalakeAnalyticsCatalogAndJobEndpoint": "azuredatalakeanalytics.net",
    "azureDatalakeStoreFileSystemEndpoint": "azuredatalakestore.net",
    "keyvaultDns": ".vault.azure.net",
    "mariadbServerEndpoint": ".mariadb.database.azure.com",
    "mhsmDns": ".managedhsm.azure.net",
    "mysqlServerEndpoint": ".mysql.database.azure.com",
    "postgresqlServerEndpoint": ".postgres.database.azure.com",
    "sqlServerHostname": ".database.windows.net",
    "storageEndpoint": "core.windows.net",
    "storageSyncEndpoint": "afs.azure.net",
    "synapseAnalyticsEndpoint": ".dev.azuresynapse.net"
  }
}

Additional context

Azure Cloud Suffix Reference
AzureCloud *.cloudapp.azure.com
AzureUSGovernment *.cloudapp.usgovcloudapi.net Doc
AzureChinaCloud *.cloudapp.chinacloudapi.cn Doc

I could not found any information on this suffix for AzureGermanCloud.

s4heid avatar Jun 29 '24 11:06 s4heid

Thank you for opening this issue, we will look into it.

yonzhan avatar Jun 29 '24 11:06 yonzhan

Previously there was an attempt https://github.com/Azure/azure-cli/pull/25834 to bump /metadata/endpoints API version from 2015-01-01 to 2022-09-01: https://management.azure.com/metadata/endpoints?api-version=2022-09-01

However, the response doesn't seem to contain the Service Fabric endpoint:

{
    "portal": "https://portal.azure.com",
    "authentication": {
        "loginEndpoint": "https://login.microsoftonline.com",
        "audiences": [
            "https://management.core.windows.net/",
            "https://management.azure.com/"
        ],
        "tenant": "common",
        "identityProvider": "AAD"
    },
    "media": "https://rest.media.azure.net",
    "graphAudience": "https://graph.windows.net/",
    "graph": "https://graph.windows.net/",
    "name": "AzureCloud",
    "suffixes": {
        "azureDataLakeStoreFileSystem": "azuredatalakestore.net",
        "acrLoginServer": "azurecr.io",
        "sqlServerHostname": "database.windows.net",
        "azureDataLakeAnalyticsCatalogAndJob": "azuredatalakeanalytics.net",
        "keyVaultDns": "vault.azure.net",
        "storage": "core.windows.net",
        "azureFrontDoorEndpointSuffix": "azurefd.net",
        "storageSyncEndpointSuffix": "afs.azure.net",
        "mhsmDns": "managedhsm.azure.net",
        "mysqlServerEndpoint": "mysql.database.azure.com",
        "postgresqlServerEndpoint": "postgres.database.azure.com",
        "mariadbServerEndpoint": "mariadb.database.azure.com",
        "synapseAnalytics": "dev.azuresynapse.net",
        "attestationEndpoint": "attest.azure.net"
    },
    "batch": "https://batch.core.windows.net/",
    "resourceManager": "https://management.azure.com/",
    "vmImageAliasDoc": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json",
    "activeDirectoryDataLake": "https://datalake.azure.net/",
    "sqlManagement": "https://management.core.windows.net:8443/",
    "microsoftGraphResourceId": "https://graph.microsoft.com/",
    "appInsightsResourceId": "https://api.applicationinsights.io",
    "appInsightsTelemetryChannelResourceId": "https://dc.applicationinsights.azure.com/v2/track",
    "attestationResourceId": "https://attest.azure.net",
    "synapseAnalyticsResourceId": "https://dev.azuresynapse.net",
    "logAnalyticsResourceId": "https://api.loganalytics.io",
    "ossrDbmsResourceId": "https://ossrdbms-aad.database.windows.net"
}

jiasli avatar Jul 01 '24 07:07 jiasli

@jiasli Given that it's an "official" Azure Endpoint, it seems appropriate to include it in /metadata/endpoints. If you're still considering moving to a mechanism that automatically populates endpoints from the API (#25834) instead of using hardcoded values, contributing it back to /metadata/endpoints would be the best in my opinion.

s4heid avatar Jul 17 '24 08:07 s4heid