We have deployed an Azure front door premium instance connecting to an App Service instance over private endpoints using Az powershell, namely New-AzFrontDoorCdnOrigin
then approving with Approve-AzPrivateEndpointConnection
.
This all works fine.
However, how can this link be removed via preferably Az powershell?
It is as simple as unchecking the "Enable private link service" in the portal, but the Az powershell documentation is unclear to me here.
Things I’ve tried:
- Using
Update-AzFrontDoorCdnOrigin
: specifying aSharedPrivateLinkResourceStatus
of Removed or Disconnected does nothing. - Using
Update-AzFrontDoorCdnOrigin
:PrivateLinkId
of empty or null is not allowed. - Using
Remove-AzPrivateEndpointConnection
. This removes the connection at the app service, but front door is not aware of the change in state and stops routing traffic to the app service until you manually uncheck the "Enable private link service" box on the origin.
Current workaround is
- Create a second temporary origin in the origin group (so that I don’t have to disconnect the origin group from the route, etc)
- Delete the origin with the private link
- Recreate the origin (pref is to have origin with the original name)
- Delete the temporary origin
2
Answers
Issues may arise because of active connections. The problem will be resolved if all connections were rejected or deleted before deleting the service.
Usually, front door service is not renewed immediately. Before you delete the service, ensure that there are no private endpoint connections associated with it.
Need to delete the Endpoints which links to Private link by using this command
Remove all end points
Remove private link service from the service.
Remove-AzPrivateLinkService -ResourceGroupName rg-swarnaacctestrg -Name privatelinkswarna
From Front Door side, we need to purge the so that changes will reflect/ refresh
az afd endpoint purge -g <ResourceGroupName> --profile-name profile --domains <DomainName> --content-paths '/*'
I know the question is about
Az Powershell
however if you have stumbled upon this don’t waste your time :). The only way I was able to resolve the this was withaz cli
and the use ofaz afd origin create
andaz afd origin update
.see
https://learn.microsoft.com/en-us/cli/azure/afd/origin?view=azure-cli-latest#az-afd-origin-create
and https://learn.microsoft.com/en-us/cli/azure/afd/origin?view=azure-cli-latest#az-afd-origin-update