防止意外删除 Azure 文件共享Prevent accidental deletion of Azure file shares
Azure 存储现在为文件共享（预览版）提供了软删除功能。Azure Storage now offers soft delete for file shares (preview). 使用软删除，可在应用程序或其他存储帐户用户错误地删除了文件共享后恢复文件共享。Soft delete allows you to recover your file share when it is mistakenly deleted by an application or other storage account user.
软删除（预览版）的工作原理How soft delete (preview) works
启用 Azure 文件共享的软删除后，如果删除文件共享，它将转换为软删除状态，而不是被永久删除。When soft delete for Azure file shares is enabled, if a file share is deleted, it transitions to a soft deleted state instead of being permanently erased. 可配置软删除数据被永久删除前的可恢复时间，并在此保留期内随时取消删除共享。You can configure the amount of time soft deleted data is recoverable before it's permanently deleted, and undelete the share anytime during this retention period. 取消删除之后，共享和所有内容（包括快照）将还原到删除之前的状态。After being undeleted, the share and all of contents, including snapshots, will be restored to the state it was in prior to deletion. 软删除仅适用于文件共享级别 - 删除的单个文件仍会被永久删除。Soft delete only works on a file share level - individual files that are deleted will still be permanently erased.
可以在新的或现有的文件共享上启用软删除。Soft delete can be enabled on either new or existing file shares. 此外，软删除还向后兼容，因此无需对应用程序进行任何更改即可利用软删除提供的保护。Soft delete is also backwards compatible, so you don't have to make any changes to your applications to take advantage of the protections of soft delete.
若要在到期时间之前永久删除处于软删除状态的文件共享，必须取消删除共享、禁用软删除，然后再次删除该共享。To permanently delete a file share in a soft delete state before its expiry time, you must undelete the share, disable soft delete, and then delete the share again. 然后，应重新启用软删除，因为当软删除处于禁用状态时，该存储帐户中的任何其他文件共享可能会被意外删除。Then you should re-enable soft delete, since any other file shares in that storage account will be vulnerable to accidental deletion while soft delete is off.
对于软删除的高级文件共享，将在存储帐户总配额计算中纳入文件共享配额（预配的文件共享大小），直至达到软删除共享的到期日期，共享被完全删除为止。For soft-deleted premium file shares, the file share quota (the provisioned size of a file share) is used in the total storage account quota calculation until the soft-deleted share expiry date, when the share is fully deleted.
Azure 文件共享（预览版）的软删除在所有存储层、所有存储帐户类型以及提供 Azure 文件存储的每个区域中均可用。Soft delete for Azure file shares (preview) is available on all storage tiers, all storage account types, and in every region that Azure Files is available in.
启用或禁用软删除Enabling or disabling soft delete
文件共享的软删除在存储帐户级别启用，因此软删除设置适用于存储帐户中的所有文件共享。Soft delete for file shares is enabled at the storage account level, because of this, the soft delete settings apply to all file shares within a storage account. 可以在任何时候启用或禁用软删除。You can enable or disable soft delete at any time. 创建新存储帐户时，默认情况下禁用文件共享的软删除。When you create a new storage account, soft delete for file shares is disabled by default. 对于现有的存储帐户，默认情况下也禁用软删除。Soft delete is also disabled by default for existing storage accounts.
如果为文件共享启用软删除、删除一些文件共享，然后又禁用软删除，则在该时间段内保存的文件共享仍可供访问和恢复。If you enable soft delete for file shares, delete some file shares, and then disable soft delete, if the shares were saved in that period you can still access and recover those file shares. 启用软删除时，还需配置保持期。When you enable soft delete, you also need to configure the retention period.
保留期是已软删除的文件共享能够进行存储和恢复的时间期限。The retention period is the amount of time that soft deleted file shares are stored and available for recovery. 对于显式删除的文件共享，保持期从删除数据时开始计时。For file shares that are explicitly deleted, the retention period clock starts when the data is deleted. 目前，可以指定 1 到 365 天的保留期。Currently you can specify a retention period between 1 and 365 days. 可随时更改软删除保持期。You can change the soft delete retention period at any time. 更新后的保持期仅适用于在更新保持期后删除的共享。An updated retention period will only apply to shares deleted after the retention period has been updated. 在更新保持期之前删除的共享的过期时间取决于删除该数据时配置的保持期。Shares deleted before the retention period update will expire based on the retention period that was configured when that data was deleted.
定价和计费Pricing and billing
软删除时，标准文件共享和高级文件共享均按使用的容量计费，而不是按预配容量计费。Both standard and premium file shares are billed on the used capacity when soft deleted, rather than provisioned capacity. 此外，处于软删除状态的高级文件共享还按快照费率计费。Additionally, premium file shares are billed at the snapshot rate while in the soft delete state. 而处于软删除状态的标准文件共享按常规费率计费。Standard file shares are billed at the regular rate while in the soft delete state. 不会对在配置的保持期后永久删除的数据计费。You won't be charged for data that is permanently deleted after the configured retention period.
初次启用软删除时，建议使用较短的保持期，以便更好地了解因该功能而产生的费用变动。When you initially enable soft delete, we recommend using a small retention period to better understand how the feature affects your bill.