Update deviceManagementPartner
Article
11/30/2023
11 contributors
Feedback
In this article
Namespace: microsoft.graph
Note: The Microsoft Graph API for Intune requires an active Intune license for the tenant.
Update the properties of a deviceManagementPartner 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
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions .
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
DeviceManagementServiceConfig.ReadWrite.All, DeviceManagementConfiguration.ReadWrite.All
Delegated (personal Microsoft account)
Not supported.
Application
DeviceManagementServiceConfig.ReadWrite.All, DeviceManagementConfiguration.ReadWrite.All
HTTP Request
PATCH /deviceManagement/deviceManagementPartners/{deviceManagementPartnerId}
Request body
In the request body, supply a JSON representation for the deviceManagementPartner object.
The following table shows the properties that are required when you create the deviceManagementPartner .
Property
Type
Description
id
String
Id of the entity
lastHeartbeatDateTime
DateTimeOffset
Timestamp of last heartbeat after admin enabled option Connect to Device management Partner
partnerState
deviceManagementPartnerTenantState
Partner state of this tenant. Possible values are: unknown
, unavailable
, enabled
, terminated
, rejected
, unresponsive
.
partnerAppType
deviceManagementPartnerAppType
Partner App type. Possible values are: unknown
, singleTenantApp
, multiTenantApp
.
singleTenantAppId
String
Partner Single tenant App id
displayName
String
Partner display name
isConfigured
Boolean
Whether device management partner is configured or not
whenPartnerDevicesWillBeRemovedDateTime
DateTimeOffset
DateTime in UTC when PartnerDevices will be removed
whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime
DateTimeOffset
DateTime in UTC when PartnerDevices will be marked as NonCompliant
groupsRequiringPartnerEnrollment
deviceManagementPartnerAssignment collection
User groups that specifies whether enrollment is through partner.
Response
If successful, this method returns a 200 OK
response code and an updated deviceManagementPartner object in the response body.
Example
Request
Here is an example of the request.
PATCH https://graph.microsoft.com/v1.0/deviceManagement/deviceManagementPartners/{deviceManagementPartnerId}
Content-type: application/json
Content-length: 803
{
"@odata.type": "#microsoft.graph.deviceManagementPartner",
"lastHeartbeatDateTime": "2016-12-31T23:59:37.9174975-08:00",
"partnerState": "unavailable",
"partnerAppType": "singleTenantApp",
"singleTenantAppId": "Single Tenant App Id value",
"displayName": "Display Name value",
"isConfigured": true,
"whenPartnerDevicesWillBeRemovedDateTime": "2016-12-31T23:56:38.2655023-08:00",
"whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime": "2016-12-31T23:58:42.2131231-08:00",
"groupsRequiringPartnerEnrollment": [
{
"@odata.type": "microsoft.graph.deviceManagementPartnerAssignment",
"target": {
"@odata.type": "microsoft.graph.configurationManagerCollectionAssignmentTarget",
"collectionId": "Collection Id value"
}
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new DeviceManagementPartner
{
OdataType = "#microsoft.graph.deviceManagementPartner",
LastHeartbeatDateTime = DateTimeOffset.Parse("2016-12-31T23:59:37.9174975-08:00"),
PartnerState = DeviceManagementPartnerTenantState.Unavailable,
PartnerAppType = DeviceManagementPartnerAppType.SingleTenantApp,
SingleTenantAppId = "Single Tenant App Id value",
DisplayName = "Display Name value",
IsConfigured = true,
WhenPartnerDevicesWillBeRemovedDateTime = DateTimeOffset.Parse("2016-12-31T23:56:38.2655023-08:00"),
WhenPartnerDevicesWillBeMarkedAsNonCompliantDateTime = DateTimeOffset.Parse("2016-12-31T23:58:42.2131231-08:00"),
GroupsRequiringPartnerEnrollment = new List<DeviceManagementPartnerAssignment>
{
new DeviceManagementPartnerAssignment
{
OdataType = "microsoft.graph.deviceManagementPartnerAssignment",
Target = new ConfigurationManagerCollectionAssignmentTarget
{
OdataType = "microsoft.graph.configurationManagerCollectionAssignmentTarget",
CollectionId = "Collection Id value",
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.DeviceManagementPartners["{deviceManagementPartner-id}"].PatchAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc device-management device-management-partners patch --device-management-partner-id {deviceManagementPartner-id} --body '{\
"@odata.type": "#microsoft.graph.deviceManagementPartner",\
"lastHeartbeatDateTime": "2016-12-31T23:59:37.9174975-08:00",\
"partnerState": "unavailable",\
"partnerAppType": "singleTenantApp",\
"singleTenantAppId": "Single Tenant App Id value",\
"displayName": "Display Name value",\
"isConfigured": true,\
"whenPartnerDevicesWillBeRemovedDateTime": "2016-12-31T23:56:38.2655023-08:00",\
"whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime": "2016-12-31T23:58:42.2131231-08:00",\
"groupsRequiringPartnerEnrollment": [\
{\
"@odata.type": "microsoft.graph.deviceManagementPartnerAssignment",\
"target": {\
"@odata.type": "microsoft.graph.configurationManagerCollectionAssignmentTarget",\
"collectionId": "Collection Id value"\
}\
}\
]\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
"time"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewDeviceManagementPartner()
lastHeartbeatDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:59:37.9174975-08:00")
requestBody.SetLastHeartbeatDateTime(&lastHeartbeatDateTime)
partnerState := graphmodels.UNAVAILABLE_DEVICEMANAGEMENTPARTNERTENANTSTATE
requestBody.SetPartnerState(&partnerState)
partnerAppType := graphmodels.SINGLETENANTAPP_DEVICEMANAGEMENTPARTNERAPPTYPE
requestBody.SetPartnerAppType(&partnerAppType)
singleTenantAppId := "Single Tenant App Id value"
requestBody.SetSingleTenantAppId(&singleTenantAppId)
displayName := "Display Name value"
requestBody.SetDisplayName(&displayName)
isConfigured := true
requestBody.SetIsConfigured(&isConfigured)
whenPartnerDevicesWillBeRemovedDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:56:38.2655023-08:00")
requestBody.SetWhenPartnerDevicesWillBeRemovedDateTime(&whenPartnerDevicesWillBeRemovedDateTime)
whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:58:42.2131231-08:00")
requestBody.SetWhenPartnerDevicesWillBeMarkedAsNonCompliantDateTime(&whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime)
deviceManagementPartnerAssignment := graphmodels.NewDeviceManagementPartnerAssignment()
target := graphmodels.NewConfigurationManagerCollectionAssignmentTarget()
collectionId := "Collection Id value"
target.SetCollectionId(&collectionId)
deviceManagementPartnerAssignment.SetTarget(target)
groupsRequiringPartnerEnrollment := []graphmodels.DeviceManagementPartnerAssignmentable {
deviceManagementPartnerAssignment,
}
requestBody.SetGroupsRequiringPartnerEnrollment(groupsRequiringPartnerEnrollment)
deviceManagementPartners, err := graphClient.DeviceManagement().DeviceManagementPartners().ByDeviceManagementPartnerId("deviceManagementPartner-id").Patch(context.Background(), requestBody, 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);
DeviceManagementPartner deviceManagementPartner = new DeviceManagementPartner();
deviceManagementPartner.setOdataType("#microsoft.graph.deviceManagementPartner");
OffsetDateTime lastHeartbeatDateTime = OffsetDateTime.parse("2016-12-31T23:59:37.9174975-08:00");
deviceManagementPartner.setLastHeartbeatDateTime(lastHeartbeatDateTime);
deviceManagementPartner.setPartnerState(DeviceManagementPartnerTenantState.Unavailable);
deviceManagementPartner.setPartnerAppType(DeviceManagementPartnerAppType.SingleTenantApp);
deviceManagementPartner.setSingleTenantAppId("Single Tenant App Id value");
deviceManagementPartner.setDisplayName("Display Name value");
deviceManagementPartner.setIsConfigured(true);
OffsetDateTime whenPartnerDevicesWillBeRemovedDateTime = OffsetDateTime.parse("2016-12-31T23:56:38.2655023-08:00");
deviceManagementPartner.setWhenPartnerDevicesWillBeRemovedDateTime(whenPartnerDevicesWillBeRemovedDateTime);
OffsetDateTime whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime = OffsetDateTime.parse("2016-12-31T23:58:42.2131231-08:00");
deviceManagementPartner.setWhenPartnerDevicesWillBeMarkedAsNonCompliantDateTime(whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime);
LinkedList<DeviceManagementPartnerAssignment> groupsRequiringPartnerEnrollment = new LinkedList<DeviceManagementPartnerAssignment>();
DeviceManagementPartnerAssignment deviceManagementPartnerAssignment = new DeviceManagementPartnerAssignment();
deviceManagementPartnerAssignment.setOdataType("microsoft.graph.deviceManagementPartnerAssignment");
ConfigurationManagerCollectionAssignmentTarget target = new ConfigurationManagerCollectionAssignmentTarget();
target.setOdataType("microsoft.graph.configurationManagerCollectionAssignmentTarget");
target.setCollectionId("Collection Id value");
deviceManagementPartnerAssignment.setTarget(target);
groupsRequiringPartnerEnrollment.add(deviceManagementPartnerAssignment);
deviceManagementPartner.setGroupsRequiringPartnerEnrollment(groupsRequiringPartnerEnrollment);
DeviceManagementPartner result = graphClient.deviceManagement().deviceManagementPartners().byDeviceManagementPartnerId("{deviceManagementPartner-id}").patch(deviceManagementPartner);
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);
const deviceManagementPartner = {
'@odata.type': '#microsoft.graph.deviceManagementPartner',
lastHeartbeatDateTime: '2016-12-31T23:59:37.9174975-08:00',
partnerState: 'unavailable',
partnerAppType: 'singleTenantApp',
singleTenantAppId: 'Single Tenant App Id value',
displayName: 'Display Name value',
isConfigured: true,
whenPartnerDevicesWillBeRemovedDateTime: '2016-12-31T23:56:38.2655023-08:00',
whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime: '2016-12-31T23:58:42.2131231-08:00',
groupsRequiringPartnerEnrollment: [
{
'@odata.type': 'microsoft.graph.deviceManagementPartnerAssignment',
target: {
'@odata.type': 'microsoft.graph.configurationManagerCollectionAssignmentTarget',
collectionId: 'Collection Id value'
}
}
]
};
await client.api('/deviceManagement/deviceManagementPartners/{deviceManagementPartnerId}')
.update(deviceManagementPartner);
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\Models\DeviceManagementPartner;
use Microsoft\Graph\Generated\Models\DeviceManagementPartnerAssignment;
use Microsoft\Graph\Generated\Models\ConfigurationManagerCollectionAssignmentTarget;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DeviceManagementPartner();
$requestBody->setOdataType('#microsoft.graph.deviceManagementPartner');
$requestBody->setLastHeartbeatDateTime(new \DateTime('2016-12-31T23:59:37.9174975-08:00'));
$requestBody->setPartnerState(new DeviceManagementPartnerTenantState('unavailable'));
$requestBody->setPartnerAppType(new DeviceManagementPartnerAppType('singleTenantApp'));
$requestBody->setSingleTenantAppId('Single Tenant App Id value');
$requestBody->setDisplayName('Display Name value');
$requestBody->setIsConfigured(true);
$requestBody->setWhenPartnerDevicesWillBeRemovedDateTime(new \DateTime('2016-12-31T23:56:38.2655023-08:00'));
$requestBody->setWhenPartnerDevicesWillBeMarkedAsNonCompliantDateTime(new \DateTime('2016-12-31T23:58:42.2131231-08:00'));
$groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1 = new DeviceManagementPartnerAssignment();
$groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1->setOdataType('microsoft.graph.deviceManagementPartnerAssignment');
$groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1Target = new ConfigurationManagerCollectionAssignmentTarget();
$groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1Target->setOdataType('microsoft.graph.configurationManagerCollectionAssignmentTarget');
$groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1Target->setCollectionId('Collection Id value');
$groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1->setTarget($groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1Target);
$groupsRequiringPartnerEnrollmentArray []= $groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1;
$requestBody->setGroupsRequiringPartnerEnrollment($groupsRequiringPartnerEnrollmentArray);
$result = $graphServiceClient->deviceManagement()->deviceManagementPartners()->byDeviceManagementPartnerId('deviceManagementPartner-id')->patch($requestBody)->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.DeviceManagement.Administration
$params = @{
"@odata.type" = "#microsoft.graph.deviceManagementPartner"
lastHeartbeatDateTime = [System.DateTime]::Parse("2016-12-31T23:59:37.9174975-08:00")
partnerState = "unavailable"
partnerAppType = "singleTenantApp"
singleTenantAppId = "Single Tenant App Id value"
displayName = "Display Name value"
isConfigured = $true
whenPartnerDevicesWillBeRemovedDateTime = [System.DateTime]::Parse("2016-12-31T23:56:38.2655023-08:00")
whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime = [System.DateTime]::Parse("2016-12-31T23:58:42.2131231-08:00")
groupsRequiringPartnerEnrollment = @(
@{
"@odata.type" = "microsoft.graph.deviceManagementPartnerAssignment"
target = @{
"@odata.type" = "microsoft.graph.configurationManagerCollectionAssignmentTarget"
collectionId = "Collection Id value"
}
}
)
}
Update-MgDeviceManagementPartner -DeviceManagementPartnerId $deviceManagementPartnerId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
from msgraph import GraphServiceClient
from msgraph.generated.models.device_management_partner import DeviceManagementPartner
from msgraph.generated.models.device_management_partner_assignment import DeviceManagementPartnerAssignment
from msgraph.generated.models.configuration_manager_collection_assignment_target import ConfigurationManagerCollectionAssignmentTarget
graph_client = GraphServiceClient(credentials, scopes)
request_body = DeviceManagementPartner(
odata_type = "#microsoft.graph.deviceManagementPartner",
last_heartbeat_date_time = "2016-12-31T23:59:37.9174975-08:00",
partner_state = DeviceManagementPartnerTenantState.Unavailable,
partner_app_type = DeviceManagementPartnerAppType.SingleTenantApp,
single_tenant_app_id = "Single Tenant App Id value",
display_name = "Display Name value",
is_configured = True,
when_partner_devices_will_be_removed_date_time = "2016-12-31T23:56:38.2655023-08:00",
when_partner_devices_will_be_marked_as_non_compliant_date_time = "2016-12-31T23:58:42.2131231-08:00",
groups_requiring_partner_enrollment = [
DeviceManagementPartnerAssignment(
odata_type = "microsoft.graph.deviceManagementPartnerAssignment",
target = ConfigurationManagerCollectionAssignmentTarget(
odata_type = "microsoft.graph.configurationManagerCollectionAssignmentTarget",
collection_id = "Collection Id value",
),
),
],
)
result = await graph_client.device_management.device_management_partners.by_device_management_partner_id('deviceManagementPartner-id').patch(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 852
{
"@odata.type": "#microsoft.graph.deviceManagementPartner",
"id": "d21e377a-377a-d21e-7a37-1ed27a371ed2",
"lastHeartbeatDateTime": "2016-12-31T23:59:37.9174975-08:00",
"partnerState": "unavailable",
"partnerAppType": "singleTenantApp",
"singleTenantAppId": "Single Tenant App Id value",
"displayName": "Display Name value",
"isConfigured": true,
"whenPartnerDevicesWillBeRemovedDateTime": "2016-12-31T23:56:38.2655023-08:00",
"whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime": "2016-12-31T23:58:42.2131231-08:00",
"groupsRequiringPartnerEnrollment": [
{
"@odata.type": "microsoft.graph.deviceManagementPartnerAssignment",
"target": {
"@odata.type": "microsoft.graph.configurationManagerCollectionAssignmentTarget",
"collectionId": "Collection Id value"
}
}
]
}