Search code examples
azureazure-powershellazure-front-doorazure-private-link

How to disconnect private link from Azure Front Door Origin via Powershell


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 a SharedPrivateLinkResourceStatus 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

Solution

  • 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 with az cli and the use of az afd origin create and az 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