{"properties":{"roleName":"Minimum permissions role","description":"This role contains the bare minimum of Azure IAM permissions","assignableScopes":["/subscriptions/SUBSCRIPTION_ID"],"permissions":[{"actions":["Microsoft.Compute/virtualMachines/read","Microsoft.Compute/disks/read","Microsoft.Insights/MetricDefinitions/read","Microsoft.Insights/Metrics/Read","Microsoft.Network/networkInterfaces/read"],"notActions":[],"dataActions":[],"notDataActions":[]}]}}
VM Assets
PLATFORM VM ID NAME COLLECTED DATA OS IP ADDRESSES
4f7bd883-b9cd-42e8-a67d-af3ec82b7f29 abc-rhel9.0-arm AZUREVM Red Hat Enterprise Linux 192.0.2.1
b5bcefcc-5565-4e45-a05a-fac055f73f14 def-rhel9.0-arm AZUREVM Red Hat Enterprise Linux 192.0.2.2
sfbcesdc-8865-4e4t-a0sf-f8sfyjf75723 ghi-ol9.3 AZUREVM Linux/UNIX 192.0.2.3
[[["易于理解","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-18。"],[],[],null,["# Discover virtual machine instances on Azure\n\nThis document describes the steps to run an inventory discovery on your\nAzure account by using the Migration Center discovery client CLI.\n\nThe `mcdc` CLI lets you collect information about your Azure\nvirtual machine (VM) instances. The `mcdc` CLI then sends\nthis information to Migration Center, where you can continue with your\nassessment.\n\nBefore you begin\n----------------\n\n1. Review the [requirements for downloading and running the `mcdc` CLI](/migration-center/docs/review-collector-cli-requirements).\n2. Complete the steps to [download the `mcdc` CLI](/migration-center/docs/download-collector-cli). Migration Center doesn't support Azure PowerShell; use Azure CLI to run the `mcdc` CLI commands.\n\nAuthenticate to Azure\n---------------------\n\nTo allow the `mcdc` CLI to access your Azure environment,\nyou need to configure the access using one of the following methods:\n\n- [Use your existing Azure credentials](#use-azure-account)\n- [Create a client secret for the `mcdc` CLI](#client-secret)\n\n### Use your existing Azure credentials\n\nTo use your existing Azure credentials, run the `mcdc` CLI\ncommands directly from the Azure Cloud Shell.\nIf you run the `mcdc` CLI from the Azure Cloud Shell, you\ncan use your existing credentials without a client secret. In this case, the\n`mcdc` CLI can access your Azure environment to\ndiscover VM instances, as granted by your credentials.\n\n### Create a client secret for the `mcdc` CLI\n\nTo allow the `mcdc` CLI access Azure resources, register\nthe `mcdc` CLI as an application in your Azure account\nand create a client secret.\n\nTo create a client secret for the `mcdc` CLI, follow\nthese steps:\n\n1. In the Azure portal, go to the **App Registration** page, and click **New registration**.\n2. To add new client credentials, click **Add a certificate or secret**.\n3. To add a new client secret, click **+ New client secret** and enter a description and expiry date for the client secret.\n4. Click **Add**.\n\nYour client secret is now ready to use. Copy the client secret value because\nyou need it later when you run the `mcdc` CLI commands.\n\n#### Create a custom role\n\nTo make sure that the `mcdc` CLI has the necessary\npermissions to access your Azure resources, you need to create a custom\nrole with the required permissions.\n\nTo create a custom role, follow these steps:\n\n1. In the Azure portal, go to the [Subscriptions](https://portal.azure.com/#view/Microsoft_Azure_Billing/SubscriptionsBlade) page and select your Azure subscription.\n2. Copy the **Subscription ID** by clicking it.\n3. Save the following JSON template and replace \u003cvar translate=\"no\"\u003eSUBSCRIPTION_ID\u003c/var\u003e\n with the **Subscription ID** you copied in Step 2:\n\n \u003cbr /\u003e\n\n ```json\n {\n \"properties\": {\n \"roleName\": \"Minimum permissions role\",\n \"description\": \"This role contains the bare minimum of Azure IAM permissions\",\n \"assignableScopes\": [\n \"/subscriptions/\u003cvar translate=\"no\"\u003eSUBSCRIPTION_ID\u003c/var\u003e\"\n ],\n \"permissions\": [\n {\n \"actions\": [\n \"Microsoft.Compute/virtualMachines/read\",\n \"Microsoft.Compute/disks/read\",\n \"Microsoft.Insights/MetricDefinitions/read\",\n \"Microsoft.Insights/Metrics/Read\",\n \"Microsoft.Network/networkInterfaces/read\"\n ],\n \"notActions\": [],\n \"dataActions\": [],\n \"notDataActions\": []\n }\n ]\n }\n }\n \n ```\n\n \u003cbr /\u003e\n\n For more information about the permission details, see [permission details](/migrate/virtual-machines/docs/5.0/reference/roles-reference#permissions_to_configure_azure_as_a_source).\n4. In the Azure portal, go to the **Access control (IAM)** page.\n\n5. To add a custom role, click **+ Add**.\n\n6. Click **Start from JSON** and then click **Select file** to upload the JSON\n file you created in Step 3.\n\n7. To review your inputs click **Review + Create** , and then to create the\n custom role click **Create**.\n\n#### Assign the custom role to the `mcdc` CLI\n\nAfter you create the custom role, you need to assign it to the\n`mcdc` CLI application to grant it the necessary permissions.\n\nTo assign a custom role to the `mcdc` CLI, follow these steps:\n\n1. In the Azure portal, go to the **Access control (IAM)** page.\n2. Click **+ Add** and then click **Add role assignment**.\n3. In the custom role that you created ([Create a custom role](#create-a-custom-role)), enter `m2vm` and select the role.\n4. Click **Next**.\n5. Click **+ Select members** and search for the `mcdc` CLI that you registered in [Register the `mcdc` CLI](#client-secret) and click **Select**.\n6. To review and assign the custom role to your app, click **Review + Assign**.\n\nDiscover VM instances on Azure\n------------------------------\n\nTo collect inventory information from your Azure VM instances, follow these\nsteps:\n\n1. In the command line terminal, change to the directory where you downloaded\n the `mcdc` CLI.\n\n2. Run the discovery:\n\n ### Azure Cloud Shell\n\n To discover VM instances from Azure Cloud Shell by using your existing\n Azure credentials, run the following command:\n\n\n ### Linux\n\n \u003cbr /\u003e\n\n ```\n ./mcdc discover azure --tenant TENANT_ID \n\n --subscription SUBSCRIPTION_ID \n\n --host-credentials\n \n ```\n\n \u003cbr /\u003e\n\n ### Windows\n\n \u003cbr /\u003e\n\n ```\n mcdc.exe discover azure --tenant TENANT_ID \n\n --subscription SUBSCRIPTION_ID \n\n --host-credentials\n \n ```\n\n \u003cbr /\u003e\n\n \u003cbr /\u003e\n\n ### Client secret\n\n To discover VM instances from any computer with access to your Azure\n account by using the client secret, run the following command:\n\n\n ### Linux\n\n \u003cbr /\u003e\n\n ```\n ./mcdc discover azure --tenant TENANT_ID \n\n --subscription SUBSCRIPTION_ID \n\n --client CLIENT_ID \n\n --secret CLIENT_SECRET \n\n [--resource-group RESOURCE_GROUP]\n \n ```\n\n \u003cbr /\u003e\n\n ### Windows\n\n \u003cbr /\u003e\n\n ```\n mcdc.exe discover azure --tenant TENANT_ID \n\n --subscription SUBSCRIPTION_ID \n\n --client CLIENT_ID \n\n --secret CLIENT_SECRET \n\n [--resource-group RESOURCE_GROUP]\n \n ```\n\n \u003cbr /\u003e\n\n \u003cbr /\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eTENANT_ID\u003c/var\u003e: the unique identifier for your Azure Active Directory (AAD) tenant.\n - \u003cvar translate=\"no\"\u003eSUBSCRIPTION_ID\u003c/var\u003e: the subscription ID that you created in the [Create a custom role](#create-a-custom-role) section.\n - \u003cvar translate=\"no\"\u003eCLIENT_ID\u003c/var\u003e: the client ID you created in the [Register the `mcdc` CLI](#client-secret) section.\n - \u003cvar translate=\"no\"\u003eCLIENT_SECRET\u003c/var\u003e: the client secret you created in the [Register the `mcdc` CLI](#client-secret) section.\n - \u003cvar translate=\"no\"\u003eRESOURCE_GROUP\u003c/var\u003e: the Azure resource group that contains the VM instances that you want to discover. This flag is optional.\n\nThe output should look similar to the following: \n\n [+] Collecting Azure VM instances...\n Collecting region eu-west-1\n Collected 73 Azure VM instances\n [✓] Collection completed.\n\nAfter the discovery finishes, to review the collected data, run the `discover ls`\ncommand: \n\n### Linux\n\n\u003cbr /\u003e\n\n```\n./mcdc discover ls\n```\n\n\u003cbr /\u003e\n\n### Windows\n\n\u003cbr /\u003e\n\n```\nmcdc.exe discover ls\n```\n\n\u003cbr /\u003e\n\nThe output should look similar to the following: \n\n VM Assets\n PLATFORM VM ID NAME COLLECTED DATA OS IP ADDRESSES\n 4f7bd883-b9cd-42e8-a67d-af3ec82b7f29 abc-rhel9.0-arm AZUREVM Red Hat Enterprise Linux 192.0.2.1\n b5bcefcc-5565-4e45-a05a-fac055f73f14 def-rhel9.0-arm AZUREVM Red Hat Enterprise Linux 192.0.2.2\n sfbcesdc-8865-4e4t-a0sf-f8sfyjf75723 ghi-ol9.3 AZUREVM Linux/UNIX 192.0.2.3\n\nWhat's next\n-----------\n\n- Learn how to [run a guest discovery](/migration-center/docs/run-guest-discovery).\n- Learn how to [export collected data to Migration Center](/migration-center/docs/export-collected-data)."]]