Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug/Feature] Linter tells me to use the suffixes for trafficmanager.net when no entry exists. #15895

Open
jackbatzner opened this issue Dec 16, 2024 · 1 comment
Labels
intermediate language Related to the intermediate language Quality Sprint: Yes

Comments

@jackbatzner
Copy link

Describe the bug

When attempting to create a Microsoft.Web/certificates managed certificate in Bicep, the linter informs me that I should use the environment().suffixes to not hardcode the url. 

To Reproduce
Steps to reproduce the behavior:

param name string

resource certificate 'Microsoft.Web/certificates@2024-04-01' = {
  name: '${name}.trafficmanager.net-cert'
  location: 'eastus'
  properties: {
    serverFarmId: 'serverFarmId'
    canonicalName: '${name}.trafficmanager.net'
  }
}

Produces a linter error for: Environment URLs should not be hardcoded. Use the environment() function to ensure compatibility across clouds. Found this disallowed host: "trafficmanager.net"

Additional context

This is a bug and/or feature request. Can we add traffic manager to the environment suffixes? If not, can we suppress the warning for URLs that wouldn't be in the environment suffixes?

@jeskew
Copy link
Contributor

jeskew commented Dec 26, 2024

There are a few entries in the disallowedHosts property of the default configuration for this linter that are not included in the return value for the [environment()] function in ARM but are included in the return value for Get-AzEnvironment. environment() returns the following:

{
    "name": "AzureCloud",
    "gallery": "https://gallery.azure.com/",
    "graph": "https://graph.windows.net/",
    "portal": "https://portal.azure.com",
    "graphAudience": "https://graph.windows.net/",
    "activeDirectoryDataLake": "https://datalake.azure.net/",
    "batch": "https://batch.core.windows.net/",
    "media": "https://rest.media.azure.net",
    "sqlManagement": "https://management.core.windows.net:8443/",
    "vmImageAliasDoc": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json",
    "resourceManager": "https://management.azure.com/",
    "authentication": {
        "loginEndpoint": "https://login.microsoftonline.com/",
        "audiences": [
            "https://management.core.windows.net/",
            "https://management.azure.com/"
        ],
        "tenant": "common",
        "identityProvider": "AAD"
    },
    "suffixes": {
        "acrLoginServer": ".azurecr.io",
        "azureDatalakeAnalyticsCatalogAndJob": "azuredatalakeanalytics.net",
        "azureDatalakeStoreFileSystem": "azuredatalakestore.net",
        "azureFrontDoorEndpointSuffix": "azurefd.net",
        "keyvaultDns": ".vault.azure.net",
        "sqlServerHostname": ".database.windows.net",
        "storage": "core.windows.net"
    }
}

There's no entry with the trafficmanager.net domain name, but the domain does vary by cloud and is something you can query via the CLI or PowerShell:

Image

This seems like something that should be addressed in ARM.

@jeskew jeskew added the intermediate language Related to the intermediate language label Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
intermediate language Related to the intermediate language Quality Sprint: Yes
Projects
Status: Todo
Development

No branches or pull requests

3 participants