Search code examples
azureazure-sql-database

Can I download an Azure SQL backup from Get-AzSqlDatabaseGeoBackup?


I run the following in PowerShell:

Get-AzSqlDatabaseGeoBackup -ResourceGroupName "ContosoResourceGroup" -ServerName "ContosoServer"

It lists all the backups for the databases, specifically the ResourceId for each.

Now the resource id I assume is a blob because they are db backups?

How do I copy that blob to a storage account in Azure using az cli?


Solution

  • Now the resource id I assume is a blob because they are db backups?

    Agreed with @Venkat V The Resource ID is not a blob, its essential for uniquely identifying and referencing Azure resources when performing operations such as management, monitoring, or automation using Azure APIs, PowerShell cmdlets, Azure CLI, or Terraform.

    How do I copy that blob to a storage account in Azure using az cli?

    • Azure CLI you need to use az sql db export as following command here you can use both SQL user credentials or admin user and password created when the SQL server was provisioned.

    enter image description here

    az sql db export -s ServerName -n DatabaseName -g ResourceGroupName --admin-password "password" --admin-user "SQL username/ AD usename" --auth-type ADPassword/SQL --storage-key Storage_account_key== --storage-key-type StorageAccessKey --storage-uri "https://StorageAccountName.blob.core.windows.net/Folder1/myBacpac1.bacpac"