4.0 Step 1: Add an Azure Platform

This example shows how to create a platform for an Azure location. Look at the API reference documentation under Platforms > POST to understand what parameters to include with the request body.

Method: POST

https://10.10.10.143/MigrateApi/2019.8/platforms

{
    "username": "username@accountname.onmicrosoft.com",
    "password": "Azure password goes here",
    "type": "AddPlatformAzureCloud",
    "azureCloudName": "AzureCloud",
    "locationName": "centralus",
    "subscriptionId": "Subscription id goes here",
    "applicationId": "Application id goes here"
}

Here is the data that the POST method returned. The response provides a link to an operations resource that you can query to see when the operation finishes.

Response: Data returned from POST

{
    "completedSynchronously": false,
    "operation": {
        "href": "https://10.10.10.143/MigrateApi/2019.8/operations/ff7a4b13-0ae8-4172-b6be-aa6400e2b87e",
        "rel": "self",
        "methods": [
            "GET"
        ]
    },
    "resource": {
        "href": "https://10.10.10.143/MigrateApi/2019.8/platforms/82bf9b3f-075d-4513-8124-aa6400e2b870",
        "rel": "resource",
        "methods": [
            "GET"
        ]
    }
}

If you click the operations resource link that is provided, you can get the state of the operation. This first example shows the operation is in progress.

Method: GET

https://10.10.10.143/MigrateApi/2019.8/operations/ff7a4b13-0ae8-4172-b6be-aa6400e2b87e

The following response shows what the operation looks like when the POST operation is still in progress. The "status" field at the top level is "running".

Response: Data returned from GET

{
    "operationType": "PreDiscovery",
    "subOperations": [
        {
            "name": "DiscoveringWorkloadTarget",
            "progress": 0,
            "subOperations": [
                {
                    "name": "Operations.Cloud.DiscoverRegion",
                    "progress": 1,
                    "subOperations": null,
                    "startedAt": "2019-06-06T19:45:37.71",
                    "finishedAt": "0001-01-01T00:00:00",
                    "status": "running",
                    "links": []
                }
            ],
            "startedAt": "2019-06-06T19:45:27",
            "finishedAt": null,
            "status": "running",
            "links": []
        }
    ],
    "operationResults": [],
    "volumesTransferStatistic": null,
    "startedAt": "2019-06-06T19:45:27",
    "finishedAt": null,
    "status": "running",
    "links": [
        {
            "href": "https://10.10.10.143/MigrateApi/2019.8/operations/ff7a4b13-0ae8-4172-b6be-aa6400e2b87e",
            "rel": "self",
            "methods": [
                "GET"
            ]
        },
        {
            "href": "https://10.10.10.143/MigrateApi/2019.8/platforms/82bf9b3f-075d-4513-8124-aa6400e2b870?operation=abort",
            "rel": "operation-abort",
            "methods": [
                "POST"
            ]
        }
    ]
}

If you click the operations resource link that is provided again to get an updated status for the Azure platform that is being created. The following response shows what the operation looks like after the add Azure platform request has completed. The "status" field at the top level is "success".

Method: GET

https://10.10.10.143/MigrateApi/2019.8/operations/ff7a4b13-0ae8-4172-b6be-aa6400e2b87e

Response: Data returned from GET

{
    "operationType": "PreDiscovery",
    "subOperations": [
        {
            "name": "DiscoveringWorkloadTarget",
            "progress": 100,
            "subOperations": [
                {
                    "name": "Operations.Cloud.DiscoverRegion",
                    "progress": 100,
                    "subOperations": null,
                    "startedAt": "2019-06-06T19:45:37.71",
                    "finishedAt": "2019-06-06T19:45:58.07",
                    "status": "success",
                    "links": []
                }
            ],
            "startedAt": "2019-06-06T19:45:27",
            "finishedAt": "2019-06-06T19:46:02",
            "status": "success",
            "links": []
        }
    ],
    "operationResults": [],
    "volumesTransferStatistic": null,
    "startedAt": "2019-06-06T19:45:27",
    "finishedAt": "2019-06-06T19:46:07",
    "status": "success",
    "links": [
        {
            "href": "https://10.10.10.143/MigrateApi/2019.8/operations/ff7a4b13-0ae8-4172-b6be-aa6400e2b87e",
            "rel": "self",
            "methods": [
                "GET"
            ]
        }
    ]
}