Rediger

Get spendingPolicy

Important

APIs under the /beta version are subject to change. Use of these APIs in production applications is not supported.

Retrieve the properties and relationships of a spendingPolicy object. The returned object is polymorphic and carries an @odata.type property that identifies its concrete type.

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) CopilotCostManagement-Policy.Read.All CopilotCostManagement-Policy.ReadWrite.All, CopilotCostManagement.Read.All
Delegated (personal Microsoft account) Not supported. Not supported.
Application CopilotCostManagement-Policy.Read.All CopilotCostManagement-Policy.ReadWrite.All, CopilotCostManagement.Read.All

This table describes the Graph permission model. See permission availability and authorization for deployment requirements.

HTTP request

GET /copilot/costManagement/spendingPolicies/{id}

Optional query parameters

This method supports the $select OData query parameter to help customize the response. The serviceSettings, emailThresholdSettings, and assignedGroups relationships aren't expandable on this method.

The billingInstrument complex property is returned inline, not through $expand. You can select the complete object or a nested member such as $select=billingInstrument/provisioningStatus.

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Request body

Don't supply a request body for this method.

Response

If successful, this method returns a 200 OK response code and a spendingPolicy object in the response body.

For pay-as-you-go policies, billingInstrument describes the same tracked instrument's coordinates, resource ID, and resource provisioning state. The resource state is independent of the policy's status. If provisioningStatus is unavailable or unrecorded, it's omitted; absence doesn't indicate success. The service-generated billingResourceId is omitted when unavailable. Neither computed member is returned as null.

Example

Request

The following example selects a policy's funding and billing instrument.

GET https://graph.microsoft.com/beta/copilot/costManagement/spendingPolicies/3f9e2c1a-0000-0000-0000-00000000c21b?$select=id,status,billingMethods,billingInstrument

Response

The following example shows a provisioned Azure billing resource while the selected-groups policy is still disabled because its audience isn't ready. The account name is illustrative and generated by the service, not supplied by the caller.

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#copilot/costManagement/spendingPolicies(id,status,billingMethods,billingInstrument)/$entity",
  "@odata.type": "#microsoft.graph.selectedGroupsSpendingPolicy",
  "id": "3f9e2c1a-0000-0000-0000-00000000c21b",
  "status": "disabled",
  "billingMethods": "payAsYouGo",
  "billingInstrument": {
    "billingSubscriptionId": "11111111-2222-3333-4444-555555555555",
    "billingResourceGroup": "Finance",
    "billingRegion": "UnitedStates",
    "billingResourceId": "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Finance/providers/Microsoft.PowerPlatform/accounts/generated-account",
    "provisioningStatus": "succeeded"
  }
}