Create backup of Azure SQL database
 
	
When you use Azure SQL Database, then you should understand, that it has something different from on-prem version. And you will find it only when you start to work with it.
Backup
Backup is created automatically by Azure services, but if you need to create a backup manually in a moment, for example, before installing an update or to copy production database to the test environment. Within on-prem versions of SQL you could do a backup with SMSS and save a backup file at local drive. With cloud service you don't have access to a file system. And that's why you should use specific tools.
SqlPackage
SqlPackage is a command line utility to automate the database development tasks. You can download it at microsoft.com. I prefer to install it as a global .Net tool with this command
dotnet tool install -g microsoft.sqlpackageTo create a database backup with sqlpackage, you can use the PowerShell script as below. It will create a database backup - tables, views, triggers. The file has an extension '.bacpac' - I think it's something like backup and package.
PowerShell script to create a backup of a database in Azure
# Define variables
$bacpacPath = "C:\Dest\Backups\database.bacpac"  # Local destination path
$sqlServerName = "my-host-in-azure-prod.database.windows.net"
$databaseName = "my-db-in-azure-prod"
$username = "myadmin"
$password = "mypass"
# Path to SqlPackage.exe
$sqlPackagePath = "SqlPackage.exe"
# Run SqlPackage to export .bacpac
& "$sqlPackagePath" /Action:Export `
  /ssn:$sqlServerName `
  /sdn:$databaseName `
  /su:$username `
  /sp:$password `
  /tf:$bacpacPath
 Pipeline sequence in PowerShell
			Pipeline sequence in PowerShell