Namespace: microsoft.graph
List application and service principal objects that are assigned an appManagementPolicy policy object.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
✅ |
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) |
Application.Read.All and Policy.Read.All |
Application.Read.All and Policy.ReadWrite.ApplicationConfiguration |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
Application.Read.All and Policy.Read.All |
Application.Read.All and Policy.ReadWrite.ApplicationConfiguration |
Important
In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. The following least privileged role is supported for this operation:
HTTP request
GET /policies/appManagementPolicies/{id}/appliesTo
Optional query parameters
This method supports the $select
, $filter
, and $top
OData query parameters to help customize the response. You can apply $filter
on properties of application or servicePrincipal objects that support $filter
. For example, the following query retrieves the appId and displayName of applications or service principals that are assigned the policy.
https://graph.microsoft.com/v1.0/policies/appManagementPolicies/{id}/appliesTo?$select=appId,displayName
For general information, see OData query parameters.
Request body
Don't supply a request body for this method.
Response
If successful, this method returns a 200 OK
response code and a collection of application and servicePrincipal objects in the response body.
Examples
Example 1: Get applications and service principal objects applied to an app management policy
Request
The following example shows a request.
GET https://graph.microsoft.com/v1.0/policies/appManagementPolicies/{id}/appliesTo
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Policies.AppManagementPolicies["{appManagementPolicy-id}"].AppliesTo.GetAsync();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
appliesTo, err := graphClient.Policies().AppManagementPolicies().ByAppManagementPolicyId("appManagementPolicy-id").AppliesTo().Get(context.Background(), nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DirectoryObjectCollectionResponse result = graphClient.policies().appManagementPolicies().byAppManagementPolicyId("{appManagementPolicy-id}").appliesTo().get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
let appliesTo = await client.api('/policies/appManagementPolicies/{id}/appliesTo')
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->policies()->appManagementPolicies()->byAppManagementPolicyId('appManagementPolicy-id')->appliesTo()->get()->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.policies.app_management_policies.by_app_management_policy_id('appManagementPolicy-id').applies_to.get()
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",
"value": [
{
"@odata.type": "#microsoft.graph.application",
"id": "0d77e011-2fc6-438f-8b93-decb4f926929",
"appId": "8f527de6-05c9-4032-bca9-b2b56ab2358a",
"displayName": "TestApp1",
"createdDateTime": "2018-01-24T05:55:37Z"
}
]
}
Example 2: Get specific properties of applications and service principal objects applied to an app management policy using $select query option
Request
The following example shows a request using $select query option.
GET https://graph.microsoft.com/v1.0/policies/appManagementPolicies/{id}/appliesTo?$select=id,appId,displayName,createdDateTime
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Policies.AppManagementPolicies["{appManagementPolicy-id}"].AppliesTo.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Select = new string []{ "id","appId","displayName","createdDateTime" };
});
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphpolicies "github.com/microsoftgraph/msgraph-sdk-go/policies"
//other-imports
)
requestParameters := &graphpolicies.AppManagementPoliciesItemAppliesToRequestBuilderGetQueryParameters{
Select: [] string {"id","appId","displayName","createdDateTime"},
}
configuration := &graphpolicies.AppManagementPoliciesItemAppliesToRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
appliesTo, err := graphClient.Policies().AppManagementPolicies().ByAppManagementPolicyId("appManagementPolicy-id").AppliesTo().Get(context.Background(), configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DirectoryObjectCollectionResponse result = graphClient.policies().appManagementPolicies().byAppManagementPolicyId("{appManagementPolicy-id}").appliesTo().get(requestConfiguration -> {
requestConfiguration.queryParameters.select = new String []{"id", "appId", "displayName", "createdDateTime"};
});
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
let appliesTo = await client.api('/policies/appManagementPolicies/{id}/appliesTo')
.select('id,appId,displayName,createdDateTime')
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Policies\AppManagementPolicies\Item\AppliesTo\AppliesToRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new AppliesToRequestBuilderGetRequestConfiguration();
$queryParameters = AppliesToRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->select = ["id","appId","displayName","createdDateTime"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->policies()->appManagementPolicies()->byAppManagementPolicyId('appManagementPolicy-id')->appliesTo()->get($requestConfiguration)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.Identity.SignIns
Get-MgPolicyAppManagementPolicyApplyTo -AppManagementPolicyId $appManagementPolicyId -Property "id,appId,displayName,createdDateTime"
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.policies.app_management_policies.item.applies_to.applies_to_request_builder import AppliesToRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = AppliesToRequestBuilder.AppliesToRequestBuilderGetQueryParameters(
select = ["id","appId","displayName","createdDateTime"],
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.policies.app_management_policies.by_app_management_policy_id('appManagementPolicy-id').applies_to.get(request_configuration = request_configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following is an example of the response that returns id
, appId
, displayName
and createdDateTime
of applications and service principals where the policy is applied.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects(id,appId,displayName,createdDateTime)",
"value": [
{
"@odata.type": "#microsoft.graph.application",
"id": "0d77e011-2fc6-438f-8b93-decb4f926929",
"appId": "8f527de6-05c9-4032-bca9-b2b56ab2358a",
"displayName": "TestApp1",
"createdDateTime": "2018-01-24T05:55:37Z"
},
{
"@odata.type": "#microsoft.graph.servicePrincipal",
"id": "0e1fa067-dcc1-4d85-9b4c-e69145dd3efb",
"appId": "255912cb-e31d-4dee-bee4-3fa5d774d6b9",
"displayName": "TestApp2",
"createdDateTime": "2018-01-24T05:55:37Z"
}
]
}