Departments - List By Billing Account Name
Lists the departments that a user has access to. The operation is supported only for billing accounts with agreement type Enterprise Agreement.
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments?api-version=2019-10-01-preview
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments?api-version=2019-10-01-preview&$expand={$expand}&$filter={$filter}
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
billing
|
path | True |
string |
The ID that uniquely identifies a billing account. |
api-version
|
query | True |
string |
The version of the API to be used with the client request. The current version is 2019-10-01-preview. |
$expand
|
query |
string |
May be used to expand the enrollment accounts. |
|
$filter
|
query |
string |
May be used to filter by department name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK. The request has succeeded. |
|
Other Status Codes |
Error response describing why the operation failed. |
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | impersonate your user account |
Examples
Departments |
Departments |
DepartmentsListByBillingAccount
Sample Request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments?api-version=2019-10-01-preview
Sample Response
{
"nextLink": "Link to next page",
"value": [
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/departmentId1",
"name": "departmentId1",
"type": "Microsoft.Billing/departments",
"properties": {
"departmentName": "departmentName1",
"costCenter": "C1",
"status": "Active"
}
},
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/departmentId2",
"name": "departmentId2",
"type": "Microsoft.Billing/departments",
"properties": {
"departmentName": "departmentName2",
"costCenter": "C4",
"status": "Active"
}
}
]
}
DepartmentsListByBillingAccountWithExpand
Sample Request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments?api-version=2019-10-01-preview&$expand=properties/enrollmentAccounts
Sample Response
{
"nextLink": "Link to next page",
"value": [
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/departmentId1",
"name": "departmentId1",
"type": "Microsoft.Billing/departments",
"properties": {
"departmentName": "departmentName1",
"costCenter": "C1",
"status": "Active",
"enrollmentAccounts": [
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/accountId0",
"name": "accountId0",
"type": "Microsoft.Billing/enrollmentAccounts",
"properties": {
"accountName": "AccountName0",
"costCenter": "C0",
"status": "Active",
"startDate": "2018-05-01T17:32:28Z",
"endDate": "2019-05-31T17:32:28Z"
}
},
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/accountId1",
"name": "accountId1",
"type": "Microsoft.Billing/enrollmentAccounts",
"properties": {
"accountName": "AccountName1",
"costCenter": "C4",
"status": "Active",
"startDate": "2018-05-01T17:32:28Z",
"endDate": "2019-05-31T17:32:28Z"
}
}
]
}
},
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/departmentId2",
"name": "departmentId2",
"type": "Microsoft.Billing/departments",
"properties": {
"departmentName": "departmentName2",
"costCenter": "C4",
"status": "Active",
"enrollmentAccounts": [
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/accountId2",
"name": "accountId2",
"type": "Microsoft.Billing/enrollmentAccounts",
"properties": {
"accountName": "AccountName2",
"costCenter": "C4",
"status": "Active",
"startDate": "2018-05-01T17:32:28Z",
"endDate": "2019-05-31T17:32:28Z"
}
},
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/accountId5",
"name": "accountId5",
"type": "Microsoft.Billing/enrollmentAccounts",
"properties": {
"accountName": "AccountName5",
"costCenter": "C4",
"status": "Active",
"startDate": "2018-05-01T17:32:28Z",
"endDate": "2019-05-31T17:32:28Z"
}
}
]
}
}
]
}
Definitions
Name | Description |
---|---|
Department |
A department. |
Department |
The list of departments. |
Enrollment |
An enrollment account. |
Error |
The details of the error. |
Error |
Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. |
Error |
Department
A department.
Name | Type | Description |
---|---|---|
id |
string |
Resource Id. |
name |
string |
Resource name. |
properties.costCenter |
string |
The cost center associated with the department. |
properties.departmentName |
string |
The name of the department. |
properties.enrollmentAccounts |
Associated enrollment accounts. By default this is not populated, unless it's specified in $expand. |
|
properties.status |
string |
The status of the department. |
type |
string |
Resource type. |
DepartmentListResult
The list of departments.
Name | Type | Description |
---|---|---|
nextLink |
string |
The link (url) to the next page of results. |
value |
The list of departments. |
EnrollmentAccount
An enrollment account.
Name | Type | Description |
---|---|---|
id |
string |
Resource Id. |
name |
string |
Resource name. |
properties.accountName |
string |
The name of the enrollment account. |
properties.accountOwner |
string |
The owner of the enrollment account. |
properties.costCenter |
string |
The cost center associated with the enrollment account. |
properties.department |
Associated department. By default this is not populated, unless it's specified in $expand. |
|
properties.endDate |
string |
The end date of the enrollment account. |
properties.startDate |
string |
The start date of the enrollment account. |
properties.status |
string |
The status of the enrollment account. |
type |
string |
Resource type. |
ErrorDetails
The details of the error.
Name | Type | Description |
---|---|---|
code |
string |
Error code. |
details |
The sub details of the error. |
|
message |
string |
Error message indicating why the operation failed. |
target |
string |
The target of the particular error. |
ErrorResponse
Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.
Name | Type | Description |
---|---|---|
error |
The details of the error. |
ErrorSubDetails
Name | Type | Description |
---|---|---|
code |
string |
Error code. |
message |
string |
Error message indicating why the operation failed. |
target |
string |
The target of the particular error. |