适用于 Azure 虚拟机(资源管理器)的自动备份 v2Automated Backup v2 for Azure Virtual Machines (Resource Manager)

自动备份 v2 在运行 SQL Server 2016/2017 Standard、Enterprise 或 Developer 版本的 Azure VM 上自动为所有现有数据库和新数据库配置到 Azure 的托管备份Automated Backup v2 automatically configures Managed Backup to Azure for all existing and new databases on an Azure VM running SQL Server 2016/2017 Standard, Enterprise, or Developer editions. 这样,便可以配置使用持久 Azure Blob 存储的定期数据库备份。This enables you to configure regular database backups that utilize durable Azure blob storage. 自动备份 v2 依赖于 SQL Server IaaS 代理扩展Automated Backup v2 depends on the SQL Server IaaS Agent Extension.

Note

Azure 提供了可以用来创建和处理资源的两个不同部署模型:Azure 资源管理器部署模型和经典部署模型Azure has two different deployment models you can use to create and work with resources: Azure Resource Manager and classic. 本文介绍了资源管理器部署模型的使用。This article covers the use of the Resource Manager deployment model. 对于新部署,建议使用资源管理器部署模型而非经典部署模型。We recommend the Resource Manager deployment model for new deployments instead of the classic deployment model.

先决条件Prerequisites

若要使用自动备份 v2,请查看以下先决条件:To use Automated Backup v2, review the following prerequisites:

操作系统Operating System:

  • Windows Server 2012 R2Windows Server 2012 R2
  • Windows Server 2016Windows Server 2016

SQL Server 版本SQL Server version/edition:

  • SQL Server 2016:Developer、Standard 或 EnterpriseSQL Server 2016: Developer, Standard, or Enterprise
  • SQL Server 2017:Developer、Standard 或 EnterpriseSQL Server 2017: Developer, Standard, or Enterprise

Important

自动备份 v2 适用于 SQL Server 2016 或更高版本。 如果使用的是 SQL Server 2014,可以使用自动备份 v1 来备份数据库。 有关详细信息,请参阅 Automated Backup for SQL Server 2014 Azure Virtual Machines(适用于 SQL Server 2014 Azure 虚拟机的自动备份)。

数据库配置Database configuration:

  • 目标数据库必须使用完整恢复模式。Target databases must use the full recovery model. 有关对备份使用完整恢复模型产生的影响的详细信息,请参阅 Backup Under the Full Recovery Model(使用完整恢复模型的备份)。For more information about the impact of the full recovery model on backups, see Backup Under the Full Recovery Model.
  • 系统数据库不需要使用完整恢复模型。System databases do not have to use full recovery model. 但是,如果需要为模型或 MSDB 创建日志备份,则必须使用完整恢复模型。However, if you require log backups to be taken for Model or MSDB, you must use full recovery model.
  • 目标数据库必须位于默认 SQL Server 实例上,或者位于正确安装的命名实例上。Target databases must be on the either the default SQL Server instance, or a properly installed named instance.

Note

自动备份依赖于 SQL Server IaaS 代理扩展。 当前的 SQL 虚拟机库映像默认添加此扩展。 有关详细信息,请参阅 SQL Server IaaS 代理扩展

设置Settings

下表描述了可为自动备份 v2 配置的选项。The following table describes the options that can be configured for Automated Backup v2. 实际配置步骤根据你使用的是 Azure 门户还是 Azure Windows PowerShell 命令而有所不同。The actual configuration steps vary depending on whether you use the Azure portal or Azure Windows PowerShell commands.

基本设置Basic Settings

设置Setting 范围(默认值)Range (Default) 说明Description
自动备份Automated Backup 启用/禁用(已禁用)Enable/Disable (Disabled) 为运行 SQL Server 2016/2017 Developer、Standard 或 Enterprise 的 Azure VM 启用或禁用自动备份。Enables or disables Automated Backup for an Azure VM running SQL Server 2016/2017 Developer, Standard, or Enterprise.
保持期Retention Period 1-30 天(30 天)1-30 days (30 days) 保留备份的天数。The number of days to retain backups.
存储帐户Storage Account Azure 存储帐户Azure storage account 用于在 Blob 存储中存储自动备份文件的 Azure 存储帐户。An Azure storage account to use for storing Automated Backup files in blob storage. 在此位置创建容器,用于存储所有备份文件。A container is created at this location to store all backup files. 备份文件命名约定包括日期、时间和数据库 GUID。The backup file naming convention includes the date, time, and database GUID.
EncryptionEncryption 启用/禁用(已禁用)Enable/Disable (Disabled) 启用或禁用加密。Enables or disables encryption. 启用加密时,用于还原备份的证书位于指定的存储帐户中。When encryption is enabled, the certificates used to restore the backup are located in the specified storage account. 该证书与命令约定使用同一个“自动备份”容器。It uses the same automaticbackup container with the same naming convention. 如果密码发生更改,则使用该密码生成新证书,但旧证书在备份之前仍会还原。If the password changes, a new certificate is generated with that password, but the old certificate remains to restore prior backups.
密码Password 密码文本Password text 加密密钥的密码。A password for encryption keys. 仅当启用了加密时才需要此设置。This password is only required if encryption is enabled. 若要还原加密的备份,必须具有创建该备份时使用的正确密码和相关证书。In order to restore an encrypted backup, you must have the correct password and related certificate that was used at the time the backup was taken.

高级设置Advanced Settings

设置Setting 范围(默认值)Range (Default) 说明Description
系统数据库备份System Database Backups 启用/禁用(已禁用)Enable/Disable (Disabled) 启用后,此功能还会备份系统数据库:Master、MSDB 和 Model。When enabled, this feature also backs up the system databases: Master, MSDB, and Model. 对于 MSDB 和 Model 数据库,如果想要创建日志备份,请验证这些数据库是否处于完整恢复模式。For the MSDB and Model databases, verify that they are in full recovery mode if you want log backups to be taken. 永远不会针对 Master 数据库创建日志备份。Log backups are never taken for Master. 此外,不会创建 TempDB 的备份。And no backups are taken for TempDB.
备份计划Backup Schedule 手动/自动(自动)Manual/Automated (Automated) 默认情况下,系统会根据日志的增长情况自动确定备份计划。By default, the backup schedule is automatically determined based on the log growth. 用户可以使用手动备份计划来指定备份时段。Manual backup schedule allows the user to specify the time window for backups. 此情况下,仅按指定的频率、在特定日期的指定时段内进行备份。In this case, backups only take place at the specified frequency and during the specified time window of a given day.
完整备份频率Full backup frequency 每日/每周Daily/Weekly 完整备份的频率。Frequency of full backups. 上述两种情况下,均在下一个计划的时间段内开始完整备份。In both cases, full backups begin during the next scheduled time window. 如果选择“每周”,备份可能会跨越好几天,直到所有数据库都已成功备份。When weekly is selected, backups could span multiple days until all databases have successfully backed up.
完整备份开始时间Full backup start time 00:00 - 23:00 (01:00)00:00 - 23:00 (01:00) 在给定的日期可以开始执行完整备份的时间。Start time of a given day during which full backups can take place.
完整备份时段Full backup time window 1 – 23 小时(1 小时)1 - 23 hours (1 hour) 在给定的日期可以执行完整备份的时段持续时间。Duration of the time window of a given day during which full backups can take place.
日志备份频率Log backup frequency 5 – 60 分钟(60 分钟)5 - 60 minutes (60 minutes) 日志备份的频率。Frequency of log backups.

了解完整备份频率Understanding full backup frequency

必须了解每日与每周完整备份之间的差别。It is important to understand the difference between daily and weekly full backups. 请考虑以下两个示例解决方案。Consider the following two example scenarios.

方案 1:每周备份Scenario 1: Weekly backups

某个 SQL Server VM 包含多个大型数据库。You have a SQL Server VM that contains a number of large databases.

在星期一,用户使用以下设置启用了自动备份 v2:On Monday, you enable Automated Backup v2 with the following settings:

  • 备份计划:手动Backup schedule: Manual
  • 完整备份频率:每周Full backup frequency: Weekly
  • 完整备份开始时间:01:00Full backup start time: 01:00
  • 完整备份时段:1 小时Full backup time window: 1 hour

这意味着,下一个可用备份时段为星期二凌晨 1 点,持续时间为 1 小时。This means that the next available backup window is Tuesday at 1 AM for 1 hour. 到时,自动备份将开始逐个备份数据库。At that time, Automated Backup begins backing up your databases one at a time. 在此方案中,由于数据库非常大,完整备份将完成前几个数据库。In this scenario, your databases are large enough that full backups complete for the first couple databases. 但是,一小时后,并非所有数据库都能得到备份。However, after one hour not all of the databases have been backed up.

如果出现此情况,自动备份会在第二天(即星期三凌晨 1 点)备份剩余的数据库,此操作持续 1 小时。When this happens, Automated Backup begins backing up the remaining databases the next day, Wednesday at 1 AM for one hour. 如果到时仍无法备份所有数据库,系统会在后一天的同一时间再次尝试备份。If not all databases have been backed up in that time, it tries again the next day at the same time. 在所有数据库均已成功备份之前,系统会不断执行此计划。This continues until all databases have been successfully backed up.

再次达到星期二后,自动备份会重新开始备份所有数据库。After it reaches Tuesday again, Automated Backup begins backing up all databases again.

此方案表明,自动备份仅在指定的时段内运行,且每个数据库每周备份一次。This scenario shows that Automated Backup only operates within the specified time window, and each database is backed up once per week. 另外,如果在一天内无法完成所有备份,备份可能会跨越好几天。This also shows that it is possible for backups to span multiple days in the case where it is not possible to complete all backups in a single day.

方案 2:每日备份Scenario 2: Daily backups

某个 SQL Server VM 包含多个大型数据库。You have a SQL Server VM that contains a number of large databases.

在星期一,用户使用以下设置启用了自动备份 v2:On Monday, you enable Automated Backup v2 with the following settings:

  • 备份计划:手动Backup schedule: Manual
  • 完整备份频率:每日Full backup frequency: Daily
  • 完整备份开始时间:22:00Full backup start time: 22:00
  • 完整备份时段:6 小时Full backup time window: 6 hours

这意味着,下一个可用备份时段为星期一晚上 10 点,持续时间为 6 小时。This means that the next available backup window is Monday at 10 PM for 6 hours. 到时,自动备份将开始逐个备份数据库。At that time, Automated Backup begins backing up your databases one at a time.

然后,在星期二晚上 10 点,再次开始完整备份所有数据库,此操作持续为 6 小时。Then, on Tuesday at 10 for 6 hours, full backups of all databases start again.

Important

计划每日备份时,建议安排一个较宽的时段,确保在此时间范围内可以备份所有数据库。 有大量的数据要备份时,这种设置尤其重要。

在门户中配置Configure in the portal

可在预配期间或针对现有 SQL Server 2016/2017 VM 使用 Azure 门户来配置自动备份 v2。You can use the Azure portal to configure Automated Backup v2 during provisioning or for existing SQL Server 2016/2017 VMs.

配置新的 VMConfigure for new VMs

在资源管理器部署模型中创建新的 SQL Server 2016 或 2017 虚拟机时,使用 Azure 门户配置自动备份 v2。Use the Azure portal to configure Automated Backup v2 when you create a new SQL Server 2016 or 2017 Virtual Machine in the Resource Manager deployment model.

在“SQL Server 设置”窗格中,选择“自动备份”。In the SQL Server settings pane, select Automated backup. 下面的 Azure 门户屏幕截图显示了“SQL 自动备份”设置。The following Azure portal screenshot shows the SQL Automated Backup settings.

Azure 门户中的 SQL 自动备份配置

Note

自动备份 v2 默认已禁用。

配置现有 VMConfigure existing VMs

对于现有的 SQL Server 虚拟机,请选择 SQL Server 虚拟机。For existing SQL Server virtual machines, select your SQL Server virtual machine. 然后选择 VM“设置”的“SQL Server 配置”部分。Then select the SQL Server configuration section of the VM Settings.

现有 VM 的 SQL 自动备份

在“SQL Server 配置”设置的“自动备份”部分,单击“编辑”按钮。In the SQL Server configuration settings, click the Edit button in the Automated backup section.

为现有 VM 配置 SQL 自动备份

完成后,单击“SQL Server 配置”设置底部的“确定”按钮保存更改。When finished, click the OK button on the bottom of the SQL Server configuration settings to save your changes.

首次启用自动备份时,Azure 会在后台配置 SQL Server IaaS 代理。If you are enabling Automated Backup for the first time, Azure configures the SQL Server IaaS Agent in the background. 在此期间,Azure 门户可能不会显示自动备份已配置。During this time, the Azure portal might not show that Automated Backup is configured. 请等待几分钟,以便安装和配置代理。Wait several minutes for the agent to be installed, configured. 之后,Azure 门户将反映出新设置。After that, the Azure portal will reflect the new settings.

使用 PowerShell 进行配置Configure with PowerShell

可以使用 PowerShell 来配置自动备份 v2。You can use PowerShell to configure Automated Backup v2. 开始之前,必须:Before you begin, you must:

Note

本文进行了更新,以便使用新的 Azure PowerShell Az 模块。This article has been updated to use the new Azure PowerShell Az module. 你仍然可以使用 AzureRM 模块,至少在 2020 年 12 月之前,它将继续接收 bug 修补程序。You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. 若要详细了解新的 Az 模块和 AzureRM 兼容性,请参阅新 Azure Powershell Az 模块简介To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. 有关 Az 模块安装说明,请参阅安装 Azure PowerShellFor Az module installation instructions, see Install Azure PowerShell.

安装 SQL IaaS 扩展Install the SQL IaaS Extension

如果通过 Azure 门户预配了 SQL Server 虚拟机,应已安装 SQL Server IaaS 扩展。If you provisioned a SQL Server virtual machine from the Azure portal, the SQL Server IaaS Extension should already be installed. 可通过调用 Get-AzVM 命令并检查 Extensions 属性,确定是否为 VM 安装了该扩展。You can determine if it is installed for your VM by calling Get-AzVM command and examining the Extensions property.

$vmname = "vmname"
$resourcegroupname = "resourcegroupname"

(Get-AzVM -Name $vmname -ResourceGroupName $resourcegroupname).Extensions 

如果已安装 SQL Server IaaS 代理扩展,应会看到列出的“SqlIaaSAgent”或“SQLIaaSExtension”。If the SQL Server IaaS Agent extension is installed, you should see it listed as "SqlIaaSAgent" or "SQLIaaSExtension". ProvisioningState 应显示“Succeeded”。ProvisioningState for the extension should also show "Succeeded".

如果未安装或未能预配该扩展,可使用以下命令来安装。If it is not installed or failed to be provisioned, you can install it with the following command. 除了 VM 名称和资源组以外,还必须指定 VM 所在的区域 ($region)。In addition to the VM name and resource group, you must also specify the region ($region) that your VM is located in.

$region = "chinanorth"
Set-AzVMSqlServerExtension -VMName $vmname `
    -ResourceGroupName $resourcegroupname -Name "SQLIaasExtension" `
    -Version "1.2" -Location $region 

验证当前设置Verify current settings

如果在预配期间启用了自动备份,可以使用 PowerShell 检查当前配置。If you enabled automated backup during provisioning, you can use PowerShell to check your current configuration. 运行 Get-AzVMSqlServerExtension 命令并检查 AutoBackupSettings 属性:Run the Get-AzVMSqlServerExtension command and examine the AutoBackupSettings property:

(Get-AzVMSqlServerExtension -VMName $vmname -ResourceGroupName $resourcegroupname).AutoBackupSettings

应会看到类似于下面的输出:You should get output similar to the following:

Enable                      : True
EnableEncryption            : False
RetentionPeriod             : 30
StorageUrl                  : https://test.blob.core.chinacloudapi.cn/
StorageAccessKey            :  
Password                    : 
BackupSystemDbs             : False
BackupScheduleType          : Manual
FullBackupFrequency         : WEEKLY
FullBackupStartTime         : 2
FullBackupWindowHours       : 2
LogBackupFrequency          : 60

如果输出显示 Enable 设置为 False,则必须启用自动备份。If your output shows that Enable is set to False, then you have to enable automated backup. 幸运的是,可通过相同的方式启用和配置自动备份。The good news is that you enable and configure Automated Backup in the same way. 有关信息,请参阅下一部分。See the next section for this information.

Note

如果在进行更改后立即检查设置,看到的可能是旧配置值。 请等待几分钟再检查设置,确保更改已应用。

配置自动备份 v2Configure Automated Backup v2

随时可以使用 PowerShell 来启用自动备份以及修改其配置和行为。You can use PowerShell to enable Automated Backup as well as to modify its configuration and behavior at any time.

首先,为备份文件选择或创建存储帐户。First, select or create a storage account for the backup files. 以下脚本将选择一个存储帐户,或者创建一个存储帐户(如果不存在)。The following script selects a storage account or creates it if it does not exist.

$storage_accountname = "yourstorageaccount"
$storage_resourcegroupname = $resourcegroupname

$storage = Get-AzStorageAccount -ResourceGroupName $resourcegroupname `
    -Name $storage_accountname -ErrorAction SilentlyContinue
If (-Not $storage)
    { $storage = New-AzStorageAccount -ResourceGroupName $storage_resourcegroupname `
    -Name $storage_accountname -SkuName Standard_GRS -Location $region } 

Note

自动备份不支持在高级存储中存储备份,但可以从使用高级存储的 VM 磁盘创建备份。

然后,使用 New-AzVMSqlServerAutoBackupConfig 命令启用并配置自动备份 v2 设置,以便在 Azure 存储帐户中存储备份。Then use the New-AzVMSqlServerAutoBackupConfig command to enable and configure the Automated Backup v2 settings to store backups in the Azure storage account. 在本示例中,备份设置为保留 10 天。In this example, the backups are set to be retained for 10 days. 系统数据库备份已启用。System database backups are enabled. 完整备份计划为每周运行,时段从 20:00 开始,持续两小时。Full backups are scheduled for weekly with a time window starting at 20:00 for two hours. 日志备份计划为每隔 30 分钟运行。Log backups are scheduled for every 30 minutes. 第二个命令 Set-AzVMSqlServerExtension 使用这些设置更新指定的 Azure VM。The second command, Set-AzVMSqlServerExtension, updates the specified Azure VM with these settings.

$autobackupconfig = New-AzVMSqlServerAutoBackupConfig -Enable `
    -RetentionPeriodInDays 10 -StorageContext $storage.Context `
    -ResourceGroupName $storage_resourcegroupname -BackupSystemDbs `
    -BackupScheduleType Manual -FullBackupFrequency Weekly `
    -FullBackupStartHour 20 -FullBackupWindowInHours 2 `
    -LogBackupFrequencyInMinutes 30 

Set-AzVMSqlServerExtension -AutoBackupSettings $autobackupconfig `
    -VMName $vmname -ResourceGroupName $resourcegroupname 

可能需要花费几分钟来安装和配置 SQL Server IaaS 代理。It could take several minutes to install and configure the SQL Server IaaS Agent.

要启用加密,请修改上述脚本,使其将 EnableEncryption 参数连同 CertificatePassword 参数的密码(安全字符串)一起传递。To enable encryption, modify the previous script to pass the EnableEncryption parameter along with a password (secure string) for the CertificatePassword parameter. 以下脚本启用上一示例中的自动备份设置,并添加加密。The following script enables the Automated Backup settings in the previous example and adds encryption.

$password = "P@ssw0rd"
$encryptionpassword = $password | ConvertTo-SecureString -AsPlainText -Force  

$autobackupconfig = New-AzVMSqlServerAutoBackupConfig -Enable `
    -EnableEncryption -CertificatePassword $encryptionpassword `
    -RetentionPeriodInDays 10 -StorageContext $storage.Context `
    -ResourceGroupName $storage_resourcegroupname -BackupSystemDbs `
    -BackupScheduleType Manual -FullBackupFrequency Weekly `
    -FullBackupStartHour 20 -FullBackupWindowInHours 2 `
    -LogBackupFrequencyInMinutes 30 

Set-AzVMSqlServerExtension -AutoBackupSettings $autobackupconfig `
    -VMName $vmname -ResourceGroupName $resourcegroupname

若要确认是否应用了这些设置,请 检查自动备份配置To confirm your settings are applied, verify the Automated Backup configuration.

禁用自动备份Disable Automated Backup

若要禁用自动备份,请运行同一个脚本,但不要为 New-AzVMSqlServerAutoBackupConfig 命令指定 -Enable 参数。To disable Automated Backup, run the same script without the -Enable parameter to the New-AzVMSqlServerAutoBackupConfig command. 缺少 -Enable 参数会向该命令发出指示以禁用此功能。The absence of the -Enable parameter signals the command to disable the feature. 与安装一样,可能需要花费几分钟时间来禁用自动备份。As with installation, it can take several minutes to disable Automated Backup.

$autobackupconfig = New-AzVMSqlServerAutoBackupConfig -ResourceGroupName $storage_resourcegroupname

Set-AzVMSqlServerExtension -AutoBackupSettings $autobackupconfig `
    -VMName $vmname -ResourceGroupName $resourcegroupname

示例脚本Example script

以下脚本提供一组可自定义的变量,用来为 VM 启用和配置自动备份。The following script provides a set of variables that you can customize to enable and configure Automated Backup for your VM. 根据具体的情况,可能需要根据要求自定义该脚本。In your case, you might need to customize the script based on your requirements. 例如,如果想要禁用系统数据库备份或启用加密,则必须更改该脚本。For example, you would have to make changes if you wanted to disable the backup of system databases or enable encryption.

$vmname = "yourvmname"
$resourcegroupname = "vmresourcegroupname"
$region = "Azure region name such as chinanorth"
$storage_accountname = "storageaccountname"
$storage_resourcegroupname = $resourcegroupname
$retentionperiod = 10
$backupscheduletype = "Manual"
$fullbackupfrequency = "Weekly"
$fullbackupstarthour = "20"
$fullbackupwindow = "2"
$logbackupfrequency = "30"

# ResourceGroupName is the resource group which is hosting the VM where you are deploying the SQL IaaS Extension 

Set-AzVMSqlServerExtension -VMName $vmname `
    -ResourceGroupName $resourcegroupname -Name "SQLIaasExtension" `
    -Version "1.2" -Location $region

# Creates/use a storage account to store the backups

$storage = Get-AzStorageAccount -ResourceGroupName $resourcegroupname `
    -Name $storage_accountname -ErrorAction SilentlyContinue
If (-Not $storage)
    { $storage = New-AzStorageAccount -ResourceGroupName $storage_resourcegroupname `
    -Name $storage_accountname -SkuName Standard_GRS -Location $region }

# Configure Automated Backup settings

$autobackupconfig = New-AzVMSqlServerAutoBackupConfig -Enable `
    -RetentionPeriodInDays $retentionperiod -StorageContext $storage.Context `
    -ResourceGroupName $storage_resourcegroupname -BackupSystemDbs `
    -BackupScheduleType $backupscheduletype -FullBackupFrequency $fullbackupfrequency `
    -FullBackupStartHour $fullbackupstarthour -FullBackupWindowInHours $fullbackupwindow `
    -LogBackupFrequencyInMinutes $logbackupfrequency

# Apply the Automated Backup settings to the VM

Set-AzVMSqlServerExtension -AutoBackupSettings $autobackupconfig `
    -VMName $vmname -ResourceGroupName $resourcegroupname

监视Monitoring

可通过两种主要方式监视 SQL Server 2016/2017 上的自动备份。To monitor Automated Backup on SQL Server 2016/2017, you have two main options. 由于自动备份使用 SQL Server 托管备份功能,同样的监视方法对两者均适用。Because Automated Backup uses the SQL Server Managed Backup feature, the same monitoring techniques apply to both.

首先,可通过调用 msdb.managed_backup.sp_get_backup_diagnostics 轮询状态。First, you can poll the status by calling msdb.managed_backup.sp_get_backup_diagnostics. 或查询 msdb.managed_backup.fn_get_health_status 表值函数。Or query the msdb.managed_backup.fn_get_health_status table valued function.

另一种方式是利用内置的数据库邮件功能进行通知。Another option is to take advantage of the built-in Database Mail feature for notifications.

  1. 调用 msdb.managed_backup.sp_set_parameter 存储过程,向 SSMBackup2WANotificationEmailIds 参数分配电子邮件地址。Call the msdb.managed_backup.sp_set_parameter stored procedure to assign an email address to the SSMBackup2WANotificationEmailIds parameter.
  2. 启用 SendGrid,从 Azure VM 发送电子邮件。Enable SendGrid to send the emails from the Azure VM.
  3. 使用 SMTP 服务器和用户名配置数据库邮件。Use the SMTP server and user name to configure Database Mail. 可在 SQL Server Management Studio 中或使用 Transact-SQL 命令配置数据库邮件。You can configure Database Mail in SQL Server Management Studio or with Transact-SQL commands. 有关详细信息,请参阅数据库邮件For more information, see Database Mail.
  4. 配置 SQL Server 代理以使用数据库邮件Configure SQL Server Agent to use Database Mail.
  5. 验证是否通过本地 VM 防火墙和适用于 VM 的网络安全组允许该 SMTP 端口。Verify that the SMTP port is allowed both through the local VM firewall and the network security group for the VM.

后续步骤Next steps

自动备份 v2 在 Azure VM 上配置托管备份。Automated Backup v2 configures Managed Backup on Azure VMs. 因此,请务必查看有关托管备份的文档,了解其行为和影响。So it is important to review the documentation for Managed Backup to understand the behavior and implications.

可以在以下文章中找到针对 Azure VM 上 SQL Server 的其他备份和还原指导:Azure 虚拟机中 SQL Server 的备份和还原You can find additional backup and restore guidance for SQL Server on Azure VMs in the following article: Backup and Restore for SQL Server in Azure Virtual Machines.

有关其他可用自动化任务的信息,请参阅 SQL Server IaaS 代理扩展For information about other available automation tasks, see SQL Server IaaS Agent Extension.

有关在 Azure VM 中运行 SQL Server 的详细信息,请参阅 Azure 虚拟机中的 SQL Server 概述For more information about running SQL Server on Azure VMs, see SQL Server on Azure Virtual Machines overview.