Azure 流量管理器终结点更新失败并显示 'The resourceTargetId property is invalid or missing'

Azure traffic manager endpoint update fails with 'The resourceTargetId property is invalid or missing'

我正在尝试使用 Azure CLI 更新 Azure 流量管理器端点,我 运行 以下代码:

 az network traffic-manager endpoint update \
      --name ${ENDPOINT_NAME} \
      --profile-name ${PROFILE_NAME} \
      --resource-group ${RESOURCE_GROUP} \
      --type azureEndpoints \
      --endpoint-status enabled \
      --set targetResourceId=${INGRESS_IP_ID}

这些不同标志的值是通过先前调用 az network traffic-manager endpoint list 获得的,但是尝试将端点 targetResourceId 设置为不同的资源失败并出现此错误:

Operation failed with status: 'Bad Request'. Details: The 'resourceTargetId' property of endpoint 'we' is invalid or missing. The property must be specified only for the following endpoint types: AzureEndpoints, NestedEndpoints. You must have read access to the resource to which it refers.

我可以绝对肯定地说,我尝试更新的端点是一个 AzureEndpoint,并且我尝试将其设置为的资源与端点本身存在于同一位置。我查看了文档并尝试 google 解决此错误,但到目前为止还没有发现任何有用的东西。

我可以生产这个问题。可能是您错误地传递了 --target-resource-id。它应该是一个完整的资源 ID,而不是资源名称。

如果您将 public IP 作为端点,您可以使用命令获取资源 ID。

az network public-ip show --name <publicIPName> --resource-group <resourceGroupName> --query "id"