[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-11。"],[],[],null,["# Back up and restore a domain\n\nThis topic shows you how to do the following tasks in\nManaged Service for Microsoft Active Directory:\n\n- Take a backup of your existing domain which saves the current state of your domain.\n- List the backups available for your domain.\n- Restore domain to a previous state using backup.\n- Get metadata information about a specific backup.\n- Update labels for your backup.\n- Delete backups which you no longer need.\n\n| **Note:** You can't use a third-party software to back up and restore a Managed Microsoft AD domain.\n\nOverview\n--------\n\nManaged Microsoft AD supports backing up and restoring your domains. There are three types of backups available:\n\n- **On-demand backup:** You can take a backup of your domain on demand in Managed Microsoft AD at any time. You can create up to five on-demand backups. If a domain already contains five on-demand backups, you must delete an existing backup before you create a new one.\n- **Scheduled backup:** Scheduled backup is created every 12 hours automatically.\n- **Schema extension backup:** Managed Microsoft AD creates a backup automatically when you initiate [schema extension](/managed-microsoft-ad/docs/schema-extension). A domain can have a maximum of 10 schema extension backups at any point in time. If a domain already has 10 schema extension backups, when you initiate schema extension, Managed Microsoft AD deletes an existing schema extension backup in chronological order before it creates a new one.\n\nYou can use any of these backup types to [perform an authoritative restore](/managed-microsoft-ad/docs/backup-restore#restore-backup), which returns the domain to a\nprevious point in time.\n| **Note:** Managed Microsoft AD retains scheduled and schema extension backups for 21 days. It retains on-demand backups forever unless you delete them.\n\nThe backup operation takes backup from the primary region domain controller. When restored, it replicates automatically to all regions.\n\nNote that during a restore, you cannot use your domain.\n\nBefore you begin\n----------------\n\n1. Make sure that you have [created a Managed Microsoft AD domain](/managed-microsoft-ad/docs/create-domain).\n2. Make sure that you have any one of the following IAM user roles:\n\n - Google Cloud Managed Identities Backup Admin (`roles/managedidentities.backupAdmin`)\n - Google Cloud Managed Identities Domain Admin (`roles/managedidentities.domainAdmin`)\n\n For more information, see [Cloud Managed Identities roles](/iam/docs/understanding-roles#cloud-managed-identities-roles).\n\n For more information about assigning an IAM role to user, see [Granting access](/iam/docs/granting-changing-revoking-access#grant-single-role).\n\nGather information\n------------------\n\nYou need the following information to work with backups:\n\n- **Domain name:** The name of your Managed Microsoft AD domain. For example, `my-domain.example.com`.\n- **Backup name:** The name for your backup must follow these rules:\n\n - Must start with a letter.\n - Must contain between 1-63 characters.\n - Must end with a number or a letter.\n - Must be unique within the domain.\n\n | **Note:** Scheduled and schema extension backups automatically generate the backup name with a timestamp. The timestamp refers to the backup creation date. For example, `scheduled-backup-2021-12-19-215800`.\n\nWork with on-demand backups\n---------------------------\n\nYou can create an on-demand backup of your domain and update its labels. You can run the following gcloud CLI commands from the project where you created your Managed Microsoft AD domain.\n\n### Create an on-demand backup\n\nTo create an on-demand backup of your domain, run the following gcloud CLI command: \n\n```\ngcloud active-directory domains backups create BACKUP_NAME \\\n --domain=DOMAIN_NAME \\\n --project=DOMAIN_RESOURCE_PROJECT_ID\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eBACKUP_NAME\u003c/var\u003e: A name for your on-demand domain backup. For example, `my-domain-backup`.\n- \u003cvar translate=\"no\"\u003eDOMAIN_NAME\u003c/var\u003e: The name of your Managed Microsoft AD domain. For example, `my-domain.example.com`.\n- \u003cvar translate=\"no\"\u003eDOMAIN_RESOURCE_PROJECT_ID\u003c/var\u003e: The project ID of the domain resource project. For example, `my-project`.\n\nYou receive the following response that indicates that backup creation has\nstarted: \n\n```\nCreate request issued for: [BACKUP_NAME]\nWaiting for operation [OPERATION_ID] to complete...\n```\n\nIt can take up to 90 minutes to create a backup. Alternatively, you can add the\n`--async` flag to execute the command in the background. Note that you can\nrepeat this process to create up to five independent on-demand backups for a domain.\n\n### Update labels for an on-demand backup\n\nTo update labels for an on-demand backup, run the following gcloud CLI command: \n\n```\ngcloud active-directory domains backups update BACKUP_NAME \\\n --domain=DOMAIN_NAME \\\n --project=DOMAIN_RESOURCE_PROJECT_ID \\\n --update-labels=KEY=VALUE\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eBACKUP_NAME\u003c/var\u003e: The name of your on-demand domain backup. For example, `my-domain-backup`.\n- \u003cvar translate=\"no\"\u003eDOMAIN_NAME\u003c/var\u003e: The name of your Managed Microsoft AD domain. For example, `my-domain.example.com`.\n- \u003cvar translate=\"no\"\u003eDOMAIN_RESOURCE_PROJECT_ID\u003c/var\u003e: The project ID of the domain resource project. For example, `my-project`.\n- \u003cvar translate=\"no\"\u003eKEY\u003c/var\u003e and \u003cvar translate=\"no\"\u003eVALUE\u003c/var\u003e: A key-value pair that you want to add to your domain backup. For example, `backupcount=1`.\n\nManage backups\n--------------\n\nTo manage all types of backups, you can run the following gcloud CLI commands from\nthe project where you created your Managed Microsoft AD domain.\n\n### List backups\n\nYou can list the backups created for a specific domain. Run the following gcloud CLI command: \n\n```\ngcloud active-directory domains backups list \\\n --domain=DOMAIN_NAME \\\n --project=DOMAIN_RESOURCE_PROJECT_ID\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eDOMAIN_NAME\u003c/var\u003e: The name of your Managed Microsoft AD domain. For example, `my-domain.example.com`.\n- \u003cvar translate=\"no\"\u003eDOMAIN_RESOURCE_PROJECT_ID\u003c/var\u003e: The project ID of the domain resource project. For example, `my-project`.\n\n### Get backup information\n\nYou can retrieve all the information specific to a domain backup. Run the following gcloud CLI command: \n\n```\ngcloud active-directory domains backups describe BACKUP_NAME \\\n --domain=DOMAIN_NAME \\\n --project=DOMAIN_RESOURCE_PROJECT_ID\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eBACKUP_NAME\u003c/var\u003e: The name of your domain backup. For example, `my-domain-backup`.\n- \u003cvar translate=\"no\"\u003eDOMAIN_NAME\u003c/var\u003e: The name of your Managed Microsoft AD domain. For example, `my-domain.example.com`.\n- \u003cvar translate=\"no\"\u003eDOMAIN_RESOURCE_PROJECT_ID\u003c/var\u003e: The project ID of the domain resource project. For example, `my-project`.\n\n### Delete a backup\n\nTo delete a backup, run the following gcloud CLI command: \n\n```\ngcloud active-directory domains backups delete BACKUP_NAME \\\n --domain=DOMAIN_NAME \\\n --project=DOMAIN_RESOURCE_PROJECT_ID\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eBACKUP_NAME\u003c/var\u003e: The name of your domain backup. For example, `my-domain-backup`.\n- \u003cvar translate=\"no\"\u003eDOMAIN_NAME\u003c/var\u003e: The name of your Managed Microsoft AD domain. For example, `my-domain.example.com`.\n- \u003cvar translate=\"no\"\u003eDOMAIN_RESOURCE_PROJECT_ID\u003c/var\u003e: The project ID of the domain resource project. For example, `my-project`.\n\nRestore a domain from a backup\n------------------------------\n\nYou can restore a domain to a previous state using any of its backups.\n\nBefore you restore a domain, make sure you refer to these [considerations](/managed-microsoft-ad/docs/restore-considerations).\n\nTo restore a domain, run the following gcloud CLI command from the\nproject where you created your Managed Microsoft AD domain. \n\n```\ngcloud active-directory domains restore DOMAIN_NAME \\\n --backup=BACKUP_NAME \\\n --project=DOMAIN_RESOURCE_PROJECT_ID\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eDOMAIN_NAME\u003c/var\u003e: The name of your Managed Microsoft AD domain. For example, `my-domain.example.com`.\n- \u003cvar translate=\"no\"\u003eBACKUP_NAME\u003c/var\u003e: The name of your domain backup. For example, `my-domain-backup`.\n- \u003cvar translate=\"no\"\u003eDOMAIN_RESOURCE_PROJECT_ID\u003c/var\u003e: The project ID of the domain resource project. For example, `my-project`.\n\nYou receive the following response that indicates that the restore process has\nstarted: \n\n```\nRequest issued for: [DOMAIN_NAME]\nWaiting for operation [OPERATION_ID] to complete...\n```\n\nIt can take up to 90 minutes to restore a domain. Alternatively, you can add the\n`--async` flag to execute the command in the background.\n| **Note:** You cannot use your domain during the restore process. When you restore a domain, the domain controllers are down for up to 90 minutes."]]