Skip to content

az afd custom-domain create with azure-dns-zone fails #30132

@utillity

Description

@utillity

Describe the bug

When I try to pass in the azure-dns-zone, the cli seems to think it's a path and make an absolute path out of it, then it complains that it's not a valid ID

Related command

az afd custom-domain create

Errors

The output including the error message

Using DNS Zone-Id: /subscriptions/xxxxxxx/resourceGroups/xxxxx/providers/Microsoft.Network/dnszones/dev.xxxxx.eco
(LinkedInvalidPropertyId) Property id 'C:/Program Files/Git/subscriptions/xxxxx/resourceGroups/xxxxxx/providers/Microsoft.Network/dnszones/dev.xxxxx.eco' at path 'properties.azureDnsZone.id' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.
Code: LinkedInvalidPropertyId
Message: Property id 'C:/Program Files/Git/subscriptions/xxxxx/resourceGroups/cxxxxxx/providers/Mi
crosoft.Network/dnszones/dev.xxxxx.eco' at path 'properties.azureDnsZone.id' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.

Issue script & Debug output

My bash script (relevant part of it)

  local zoneId=$(az network dns zone list -g "$commonResgrp" --query [0].id)
  local zoneId=${zoneId:1:-1}
  echo "Using DNS Zone-Id: $zoneId"
  # https://learn.microsoft.com/en-us/cli/azure/afd/custom-domain?view=azure-cli-latest#az-afd-custom-domain-create
  az afd custom-domain create --resource-group "$resgrp" --profile-name "$profName" \
    --host-name "$customDomain" --custom-domain-name "$afdUrl" \
    --azure-dns-zone "$zoneId" \
    --minimum-tls-version TLS12 --certificate-type AzureFirstPartyManagedCertificate

Expected behavior

It should accept the supplied zoneId /subscriptions/xxxxxxx/resourceGroups/xxxxx/providers/Microsoft.Network/dnszones/dev.xxxxx.eco

Environment Summary

$ az --version
azure-cli                         2.65.0

core                              2.65.0
telemetry                          1.1.0

Dependencies:
msal                              1.31.0
azure-mgmt-resource               23.1.1

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\xxx\.azure\cliextensions'

Python (Windows) 3.11.8 (tags/v3.11.8:db85d51, Feb  6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botNetwork - DNSaz network dnsNetwork - Front DoorService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions