I'm trying to write a powershell script to export a database to a a BACPAC from a server with Private Link configured (no public access) using the latest version of the Az module (4.8.0). I'm having a hard time understanding what parameter values I should be passing in based on teh documentation. Here is my current code:
$exportRequest = New-AzSqlDatabaseExport
-ResourceGroupName $resourceGroupName
-ServerName $databaseServerName
-DatabaseName $db
-StorageKeytype $StorageKeytype
-StorageKey $storageKeyType
-StorageUri $BacpacUri
-AdministratorLogin $databaseAdminUserName
-AdministratorLoginPassword $adminPassword `
-UseNetworkIsolation $true
-SqlServerResourceIdForPrivateLink "/subscriptions/xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/mdp-replicated-source-data-prod-rg/providers/Microsoft.Sql/servers/mdp-replicated-data-sql-prod-01"
The error message I'm getting is
New-AzSqlDatabaseExport : The specified resource 'https://management.centralus.control.database.windows.net/modules/AzureResourceManager/subscriptions/xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/mdp-replicated-source-data-prod-rg/providers/Microsoft.Sql/servers/mdp-replicated-data-sql-p
rod-01/databases/[dbname]/export?api-version=2020-02-02-preview' was not found.
Does anyone have any good working examples of how to export a database from a server with Private Link using the latest verison of the Az modules?
UPDATE: I also tried to export this database to the same storage account via the Azure portal, and got a connectivity error to the database, so perhaps I don't have the right endpoints created to do the export operation? I'm having a hard time finding any documentation that helps describe what is required to export a database with Azure Private Link configured
UPDATE 2: If I re-enable the public endpoint (via the portal) and then request an export (via the portal) it works successfully. Do we need to enable public endpoint to do the export?