Get agreement metadata for Microsoft Cloud Agreement

Applies to: Partner Center

Does not apply to: Partner Center operated by 21Vianet | Partner Center for Microsoft Cloud for US Government

The AgreementMetaData resource is currently supported by Partner Center in the Microsoft public cloud only.

The Microsoft Customer Agreement replaced the Microsoft Cloud Agreement, as of 2021. If your customer previously signed a Microsoft Cloud Agreement, its last known agreement history will be available, in addition to Microsoft Customer Agreement history.

Prerequisites

  • If you're using the Partner Center .NET SDK, version 1.9 or newer is required.

    Important

    As of June 2023, the latest Partner Center .NET SDK release 3.4.0 is now archived. You can download the SDK release from GitHub, along with a readme file that contains useful information.

    Partners are encouraged to continue to use the Partner Center REST APIs.

  • If you're using the Partner Center Java SDK, version 1.8 or newer is required.

  • Credentials as described in Partner Center authentication. This scenario supports app + user authentication.

.NET (version 1.14 or newer)

To retrieve the agreement metadata for Microsoft Cloud Agreement:

  1. First, retrieve the IAggregatePartner.AgreementDetails collection.

  2. Call ByAgreementType method to filter the collection to Microsoft Cloud Agreement.++++++++++++++++++++++++

  3. Finally, call Get or GetAsync method.

// IAggregatePartner partnerOperations;

string agreementType = "MicrosoftCloudAgreement";

var microsoftCloudAgreementDetails = partnerOperations.AgreementDetails.ByAgreementType(agreementType).Get().Items.Single();

A complete sample can be found in the GetAgreementDetails class from the console test app project.

.NET (version 1.9 - 1.13)

To retrieve agreement metadata for the Microsoft Cloud Agreement:

First retrieve the IAggregatePartner.AgreementDetails collection and then call the Get or GetAsync methods. Then search for the item within the collection, which corresponds to the Microsoft Cloud Agreement:

// IAggregatePartner partnerOperations;

var agreements = partnerOperations.AgreementDetails.Get();

AgreementMetaData microsoftCloudAgreement = agreements.Items.FirstOrDefault (agr => agr.AgreementType == AgreementType.MicrosoftCloudAgreement);

Java

The Partner Center Java SDK can be used to manage Partner Center resources. It's an open-source project maintained by the partner community and not officially supported by Microsoft. You can get help from the community or open an issue on GitHub if you experience a problem.

To retrieve agreement metadata for the Microsoft Cloud Agreement:

First call the IAggregatePartner.getAgreementDetails function and then call the get function. Then search for the item within the collection, which corresponds to the Microsoft Cloud Agreement:

// IAggregatePartner partnerOperations;

ResourceCollection<AgreementMetaData> agreements = partnerOperations.getAgreements().get();

AgreementMetaData microsoftCloudAgreement;

for (AgreementMetaData metadata : agreements)
{
    if(metadata.getAgreementType() == AgreementType.MicrosoftCloudAgreement)
    {
        microsoftCloudAgreement = metadata;
    }
}

A complete sample can be found in the GetAgreementDetails class from the console test app project.

PowerShell

The Partner Center PowerShell module can be used to manage Partner Center resources. It's an open-source project maintained by the partner community and not officially supported by Microsoft. You can get help from the community or open an issue on GitHub if you experience a problem.

To retrieve agreement metadata for the Microsoft Cloud Agreement:

Use the Get-PartnerAgreementDetail command. Then search for the item within the collection, which corresponds to the Microsoft Cloud Agreement:

Get-PartnerAgreementDetail | Where-Object {$_.AgreementType -eq 'MicrosoftCloudAgreement'} | Select-Object -First 1

REST request

To retrieve agreement metadata for Microsoft Cloud Agreement, first create a REST Request to retrieve the AgreementMetaData collection. Then search for the item in the collection that corresponds to the Microsoft Cloud Agreement.

Request syntax

Method Request URI
GET {baseURL}/v1/agreements HTTP/1.1

URI parameters

Use the following URI parameters with your request:

Name Type Required Description
agreement-type string No Use this parameter to scope the query response to specific agreement type. The supported values are:

MicrosoftCloudAgreement that includes agreement metadata only of the type MicrosoftCloudAgreement

MicrosoftCustomerAgreement that includes agreement metadata only of the type MicrosoftCustomerAgreement.

* that returns all agreement metadata. (Don't use * unless your code has the necessary runtime logic to handle unfamiliar agreement types because Microsoft might introduce agreement metadata with new agreement types at any time.)

Note: If the URI parameter isn't specified, the query defaults to MicrosoftCloudAgreement for backward compatibility.

Request headers

For more information, see Partner Center REST headers.

Request body

None.

Request example

GET https://api.partnercenter.microsoft.com/v1/agreements HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 94e4e214-6b06-4fb7-96d1-94d559f9b47f
MS-CorrelationId: ab993325-1605-4cf4-bac4-fb584142a31b

REST response

If successful, this method returns a collection of AgreementMetaData resources in the response body.

Response success and error codes

Each response comes with an HTTP status code that indicates success or failure and other debugging information. Use a network trace tool to read this code, error type, and other parameters. For the full list, see Partner Center REST error codes.

Response example

HTTP/1.1 200 OK
Content-Length: 620
Content-Type: application/json
MS-RequestId: 94e4e214-6b06-4fb7-96d1-94d559f9b47f
MS-CorrelationId: ab993325-1605-4cf4-bac4-fb584142a31b
{
    "totalCount": 1,
    "items": [
        {
            "templateId": "998b88de-aa99-4388-a42c-1b3517d49490",
            "agreementType": "MicrosoftCloudAgreement",
            "agreementLink": "https://learn.microsoft.com/partner-center/agreements",
            "versionRank": 0
        }
    ],
    "links": {
        "self": {
            "uri": "/agreements",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "Collection"
    }
}

To identify the resource in the response that corresponds to the Microsoft Cloud Agreement, look for the resource whose agreementType property has value "MicrosoftCloudAgreement".