Namespace: microsoft.graph
Important
APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Permanently delete a policyDeletableItem object, which might be one of the following deleted policy types:
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.
Permissions for restoring cross-tenant access policy objects
| Permission type |
Least privileged permission |
Higher privileged permissions |
| Delegated (work or school account) |
Not supported. |
Not supported. |
| Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
| Application |
Not supported. |
Not supported. |
Important
In delegated scenarios with work or school accounts where the signed-in user is acting on another user, they must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. The following least privileged roles are supported for this operation.
- Teams Administrator - excluding identity synchronization settings
- Security Administrator
Permissions for restoring conditional access policy objects
| Permission type |
Least privileged permissions |
Higher privileged permissions |
| Delegated (work or school account) |
Policy.ReadWrite.CrossTenantAccess |
Not available. |
| Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
| Application |
Policy.ReadWrite.CrossTenantAccess |
Not available. |
Important
In delegated scenarios with work or school accounts where the signed-in user is acting on another user, they must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. The following least privileged roles are supported for this operation.
- Security Administrator
- Conditional Access Administrator
HTTP request
Permanently delete a crossTenantAccessPolicyConfigurationPartner object:
DELETE /policies/deletedItems/crossTenantPartners/{id}
Permanently delete a crossTenantIdentitySyncPolicyPartner object:
DELETE /policies/deletedItems/crossTenantSyncPolicyPartners/{id}
Permanently delete a conditionalAccessPolicy object:
DELETE /identity/conditionalAccess/deletedItems/policies/{id}
Permanently delete a namedLocation object:
DELETE /identity/conditionalAccess/deletedItems/namedLocations/{id}
Request body
Don't supply a request body for this method.
Response
If successful, this method returns a 204 No Content response code.
Examples
Example 1: Permanently delete a deleted crossTenantAccessPolicyConfigurationPartner object
Request
The following example shows a request for crossTenantAccessPolicyConfigurationPartner.
DELETE https://graph.microsoft.com/beta/policies/deletedItems/crossTenantPartners/809cbbd2-2325-4c17-bd51-f8f098db19c8
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Policies.DeletedItems.CrossTenantPartners["{crossTenantAccessPolicyConfigurationPartner-tenantId}"].DeleteAsync();
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Policies().DeletedItems().CrossTenantPartners().ByCrossTenantAccessPolicyConfigurationPartnerTenantId("crossTenantAccessPolicyConfigurationPartner-tenantId").Delete(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
graphClient.policies().deletedItems().crossTenantPartners().byCrossTenantAccessPolicyConfigurationPartnerTenantId("{crossTenantAccessPolicyConfigurationPartner-tenantId}").delete();
const options = {
authProvider,
};
const client = Client.init(options);
await client.api('/policies/deletedItems/crossTenantPartners/809cbbd2-2325-4c17-bd51-f8f098db19c8')
.version('beta')
.delete();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$graphServiceClient->policies()->deletedItems()->crossTenantPartners()->byCrossTenantAccessPolicyConfigurationPartnerTenantId('crossTenantAccessPolicyConfigurationPartner-tenantId')->delete()->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=python
await graph_client.policies.deleted_items.cross_tenant_partners.by_cross_tenant_access_policy_configuration_partner_tenant_id('crossTenantAccessPolicyConfigurationPartner-tenantId').delete()
Response
The following example shows the response.
HTTP/1.1 204 No Content
Example 2: Permanently delete a deleted crossTenantIdentitySyncPolicyPartner object
Request
The following example shows a request for crossTenantIdentitySyncPolicyPartner.
DELETE https://graph.microsoft.com/beta/policies/deletedItems/crossTenantSyncPolicyPartners/809cbbd2-2325-4c17-bd51-f8f098db19c8
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Policies.DeletedItems.CrossTenantSyncPolicyPartners["{crossTenantIdentitySyncPolicyPartner-tenantId}"].DeleteAsync();
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Policies().DeletedItems().CrossTenantSyncPolicyPartners().ByCrossTenantIdentitySyncPolicyPartnerTenantId("crossTenantIdentitySyncPolicyPartner-tenantId").Delete(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
graphClient.policies().deletedItems().crossTenantSyncPolicyPartners().byCrossTenantIdentitySyncPolicyPartnerTenantId("{crossTenantIdentitySyncPolicyPartner-tenantId}").delete();
const options = {
authProvider,
};
const client = Client.init(options);
await client.api('/policies/deletedItems/crossTenantSyncPolicyPartners/809cbbd2-2325-4c17-bd51-f8f098db19c8')
.version('beta')
.delete();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$graphServiceClient->policies()->deletedItems()->crossTenantSyncPolicyPartners()->byCrossTenantIdentitySyncPolicyPartnerTenantId('crossTenantIdentitySyncPolicyPartner-tenantId')->delete()->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=python
await graph_client.policies.deleted_items.cross_tenant_sync_policy_partners.by_cross_tenant_identity_sync_policy_partner_tenant_id('crossTenantIdentitySyncPolicyPartner-tenantId').delete()
Response
The following example shows the response.
HTTP/1.1 204 No Content
Example 3: Permanently delete a deleted conditionalAccessPolicy object
Request
The following example shows a request for conditionalAccessPolicy.
DELETE https://graph.microsoft.com/beta/identity/conditionalAccess/deletedItems/policies/4fa582af-f900-495c-9772-ccf34d5a95fc
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Identity.ConditionalAccess.DeletedItems.Policies["{conditionalAccessPolicy-id}"].DeleteAsync();
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Identity().ConditionalAccess().DeletedItems().Policies().ByConditionalAccessPolicyId("conditionalAccessPolicy-id").Delete(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
graphClient.identity().conditionalAccess().deletedItems().policies().byConditionalAccessPolicyId("{conditionalAccessPolicy-id}").delete();
const options = {
authProvider,
};
const client = Client.init(options);
await client.api('/identity/conditionalAccess/deletedItems/policies/4fa582af-f900-495c-9772-ccf34d5a95fc')
.version('beta')
.delete();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$graphServiceClient->identity()->conditionalAccess()->deletedItems()->policies()->byConditionalAccessPolicyId('conditionalAccessPolicy-id')->delete()->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=python
await graph_client.identity.conditional_access.deleted_items.policies.by_conditional_access_policy_id('conditionalAccessPolicy-id').delete()
Response
The following example shows the response.
HTTP/1.1 204 No Content
Example 4: Permanently delete a deleted namedLocation object
Request
The following example shows a request for namedLocation.
DELETE https://graph.microsoft.com/beta/identity/conditionalAccess/deletedItems/namedLocations/b5b69bc9-3e36-4fa0-bc7f-f0e5fd3aebf1
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Identity.ConditionalAccess.DeletedItems.NamedLocations["{namedLocation-id}"].DeleteAsync();
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Identity().ConditionalAccess().DeletedItems().NamedLocations().ByNamedLocationId("namedLocation-id").Delete(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
graphClient.identity().conditionalAccess().deletedItems().namedLocations().byNamedLocationId("{namedLocation-id}").delete();
const options = {
authProvider,
};
const client = Client.init(options);
await client.api('/identity/conditionalAccess/deletedItems/namedLocations/b5b69bc9-3e36-4fa0-bc7f-f0e5fd3aebf1')
.version('beta')
.delete();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$graphServiceClient->identity()->conditionalAccess()->deletedItems()->namedLocations()->byNamedLocationId('namedLocation-id')->delete()->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=python
await graph_client.identity.conditional_access.deleted_items.named_locations.by_named_location_id('namedLocation-id').delete()
Response
The following example shows the response.
HTTP/1.1 204 No Content