[[["易于理解","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,["# Export data to Migration Center\n\nAfter you've collected the data about your assets, you can then export it to\nMigration Center where you can do the following:\n\n- [View the collected assets in one place](/migration-center/docs/view-assets)\n- [View and understand insights that Migration Center generates about your infrastructure](/migration-center/docs/view-and-understand-insights)\n- [Create groups of assets](/migration-center/docs/create-groups)\n- [Generate total cost of ownership (TCO) reports](/migration-center/docs/generate-tco-report) for your infrastructure\n\nThis document describes how to export the data to Migration Center for\nan online assessment by using the Migration Center discovery client CLI.\n\nBefore you begin\n----------------\n\n1. Complete the steps to discover assets in your infrastructure.\n2. From the Google Cloud console, [activate Migration Center](/migration-center/docs/get-started-with-migration-center#activate-migration-center).\n3. Enable the Cloud Resource Manager API.\n\n [Enable the API](https://console.cloud.google.com/apis/library/cloudresourcemanager.googleapis.com)\n\n### Review required roles and permissions\n\n\nTo get the permissions that\nyou need to export the collected data to Migration Center,\n\nask your administrator to grant you the\n\n\nMigration Center Admin (`migrationcenter.admin`)\nIAM role on the project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThis predefined role contains\n\nthe permissions required to export the collected data to Migration Center. To see the exact permissions that are\nrequired, expand the **Required permissions** section:\n\n\n#### Required permissions\n\nThe following permissions are required to export the collected data to Migration Center:\n\n- ` resourcemanager.projects.get `\n- ` migrationcenter.sources.create `\n- ` migrationcenter.sources.get `\n- ` migrationcenter.assets.reportFrames`\n\n\nYou might also be able to get\nthese permissions\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\n\n### Set up authentication to Migration Center\n\nTo export the collected data to Migration Center, you need to\nset up authentication to Migration Center with one of the following\nmethods:\n\n- Using a service account.\n- Using a personal account.\n\nWe recommend you to create a service account from the Cloud Shell\nin the Google Cloud console, which has the Google Cloud CLI already installed.\nAlternatively, if you want to use your personal account, then you need to\n[install and initialize the gcloud CLI](/sdk/docs/install).\n\n#### Set up authentication using a service account\n\n| **Note:** Service account keys are a security risk if not managed correctly. You should [choose a more secure alternative to service account keys](/docs/authentication#auth-decision-tree) whenever possible. If you must authenticate with a service account key, you are responsible for the security of the private key and for other operations described by [Best practices for managing service account keys](/iam/docs/best-practices-for-managing-service-account-keys). If you are prevented from creating a service account key, service account key creation might be disabled for your organization. For more information, see [Managing secure-by-default organization resources](/resource-manager/docs/secure-by-default-organizations).\n|\n|\n| If you acquired the service account key from an external source, you must validate it before use.\n| For more information, see [Security requirements for externally sourced credentials](/docs/authentication/external/externally-sourced-credentials).\n\n1. If you have the\n [required permissions](/iam/docs/service-accounts-create#permissions), then\n [create a service account](/iam/docs/service-accounts-create#creating):\n\n gcloud iam service-accounts create \u003cvar translate=\"no\"\u003eSA_NAME\u003c/var\u003e \\\n --description='\u003cvar translate=\"no\"\u003eSA_DESCRIPTION\u003c/var\u003e' \\\n --display-name='\u003cvar translate=\"no\"\u003eSA_DISPLAY_NAME\u003c/var\u003e'\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSA_NAME\u003c/var\u003e: the name you want for the service account\n - \u003cvar translate=\"no\"\u003eSA_DESCRIPTION\u003c/var\u003e: an optional description for the service account\n - \u003cvar translate=\"no\"\u003eSA_DISPLAY_NAME\u003c/var\u003e: the display name for the service account\n2. To grant the service account the required permissions, assign\n the [`migrationcenter.admin` role](/migration-center/docs/roles-and-permissions#migrationcenter.admin):\n\n gcloud projects add-iam-policy-binding \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n --member='serviceAccount:\u003cvar translate=\"no\"\u003eSA_NAME\u003c/var\u003e@\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e.iam.gserviceaccount.com' \\\n --role='roles/migrationcenter.admin'\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the name of your project.\n3. [Create a service account key](/iam/docs/keys-create-delete#creating):\n\n gcloud iam service-accounts keys create ~/sa-private-key.json \\\n --iam-account=\u003cvar translate=\"no\"\u003eSA_NAME\u003c/var\u003e@\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e.iam.gserviceaccount.com \\\n --billing-project \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\n The key is saved in the specified path: `~/sa-private-key.json`.\n | **Note:** It is recommended that you set an [expiration date](/iam/docs/best-practices-for-managing-service-account-keys#key-expiry) for the service account key. If you don't set an expiration date for the service account key, the generated key has no expiration date and you must delete it manually. For more information, see the [best practices for managing service account keys](/iam/docs/best-practices-for-managing-service-account-keys).\n4. Copy the key file to the machine where you want to run the\n `mcdc` CLI.\n\n#### Set up authentication using a personal account\n\n- Provide your user credentials to [Application Default Credentials (ADC)](/docs/authentication/application-default-credentials):\n\n gcloud --project \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e auth application-default login\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the name or ID of your project.\n\nExport the collected data\n-------------------------\n\nAfter the data collection and authentication setup to Migration Center\nis complete, you can proceed to exporting the collected data to\nMigration Center.\n\n- To export the collected data from your workstation to Migration Center,\n run the following command:\n\n\n ### Linux\n\n \u003cbr /\u003e\n\n ```\n ./mcdc export mc --project PROJECT_ID\n ```\n\n \u003cbr /\u003e\n\n ### Windows\n\n \u003cbr /\u003e\n\n ```\n mcdc.exe export mc --project PROJECT_ID\n ```\n\n \u003cbr /\u003e\n\n \u003cbr /\u003e\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the name of your project.\n- If you've set up authentication to Migration Center using a service\n account key, then you need to provide the path to the JSON key file using\n the `--json-key` flag:\n\n\n ### Linux\n\n \u003cbr /\u003e\n\n ```\n ./mcdc export mc --project PROJECT_ID --json-key PATH_TO_JSON_KEY\n ```\n\n \u003cbr /\u003e\n\n ### Windows\n\n \u003cbr /\u003e\n\n ```\n mcdc.exe export mc --project PROJECT_ID --json-key PATH_TO_JSON_KEY\n ```\n\n \u003cbr /\u003e\n\n \u003cbr /\u003e\n\n Replace \u003cvar translate=\"no\"\u003ePATH_TO_JSON_KEY\u003c/var\u003e with the path to the JSON key file.\n\n Optionally, if you want to wait for Migration Center to finish\n processing the assets, and check whether all the work is done successfully,\n then use the `--wait` flag with the `export` command.\n\nAfter the export is complete, the discovery client prints a link that you can\nfollow to see your assets in Migration Center.\n\nWhat's next\n-----------\n\n- Learn how to [manage the `mcdc` CLI](/migration-center/docs/manage-collector-cli).\n- Learn how to [view the collected assets in Migration Center](/migration-center/docs/view-assets)."]]