I was working on possible automation of creating private endpoints, especially connecting to private link service by using private link service alias. however, I did not find any option to do this using azure cli.
usually lots of things that azure portal can not do, they can be done using az cli; however, it seems to be inaccurate in this case. you can create private endpoints with private link service alias using portal but not with az cli.
this is very much needed in automating things in cross-subscription scenarios.
error:
az network private-endpoint create -g platdev2-cust-eastus -n testpep --subnet /subscriptions//resourceGroups/platdev2-cust-eastus/providers/Microsoft.Network/virtualNetworks/platdev2-cust-eastus-vnet/subnets/platdev2-cust-eastus-sub-endpoint-02 --private-connection-resource-id "elastic-obsv-mgmt-eastus-privlink-01.fba.eastus.azure.privatelinkservice" --connection-name test
(LinkedInvalidPropertyId) Property id 'elastic-obsv-mgmt-eastus-privlink-01.-fba.eastus.azure.privatelinkservice' at path 'properties.privateLinkServiceConnections[0].properties.privateLinkServiceId' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.
Code: LinkedInvalidPropertyId
Message: Property id 'elastic-obsv-mgmt-eastus-privlink-01.*-*****fba.eastus.azure.privatelinkservice' at path 'properties.privateLinkServiceConnections[0].properties.privateLinkServiceId' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
I was working on possible automation of creating private endpoints, especially connecting to private link service by using private link service alias. however, I did not find any option to do this using azure cli.
usually lots of things that azure portal can not do, they can be done using az cli; however, it seems to be inaccurate in this case. you can create private endpoints with private link service alias using portal but not with az cli.
this is very much needed in automating things in cross-subscription scenarios.
error:
az network private-endpoint create -g platdev2-cust-eastus -n testpep --subnet /subscriptions//resourceGroups/platdev2-cust-eastus/providers/Microsoft.Network/virtualNetworks/platdev2-cust-eastus-vnet/subnets/platdev2-cust-eastus-sub-endpoint-02 --private-connection-resource-id "elastic-obsv-mgmt-eastus-privlink-01.fba.eastus.azure.privatelinkservice" --connection-name test
(LinkedInvalidPropertyId) Property id 'elastic-obsv-mgmt-eastus-privlink-01.-fba.eastus.azure.privatelinkservice' at path 'properties.privateLinkServiceConnections[0].properties.privateLinkServiceId' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.
Code: LinkedInvalidPropertyId
Message: Property id 'elastic-obsv-mgmt-eastus-privlink-01.*-*****fba.eastus.azure.privatelinkservice' at path 'properties.privateLinkServiceConnections[0].properties.privateLinkServiceId' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.