One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
In the request body, supply a JSON representation for the managedDevice object.
The following table shows the properties that are required when you create the managedDevice.
Here is an example of the request.
POST https://graph.microsoft.com/v1.0/deviceManagement/managedDevices
Content-type: application/json
Content-length: 5058
{
"@odata.type": "#microsoft.graph.managedDevice",
"userId": "User Id value",
"deviceName": "Device Name value",
"managedDeviceOwnerType": "company",
"deviceActionResults": [
{
"@odata.type": "microsoft.graph.deviceActionResult",
"actionName": "Action Name value",
"actionState": "pending",
"startDateTime": "2016-12-31T23:58:46.7156189-08:00",
"lastUpdatedDateTime": "2017-01-01T00:00:56.8321556-08:00"
}
],
"enrolledDateTime": "2016-12-31T23:59:43.797191-08:00",
"lastSyncDateTime": "2017-01-01T00:02:49.3205976-08:00",
"operatingSystem": "Operating System value",
"complianceState": "compliant",
"jailBroken": "Jail Broken value",
"managementAgent": "mdm",
"osVersion": "Os Version value",
"easActivated": true,
"easDeviceId": "Eas Device Id value",
"easActivationDateTime": "2016-12-31T23:59:43.4878784-08:00",
"azureADRegistered": true,
"deviceEnrollmentType": "userEnrollment",
"activationLockBypassCode": "Activation Lock Bypass Code value",
"emailAddress": "Email Address value",
"azureADDeviceId": "Azure ADDevice Id value",
"deviceRegistrationState": "registered",
"deviceCategoryDisplayName": "Device Category Display Name value",
"isSupervised": true,
"exchangeLastSuccessfulSyncDateTime": "2017-01-01T00:00:45.8803083-08:00",
"exchangeAccessState": "unknown",
"exchangeAccessStateReason": "unknown",
"remoteAssistanceSessionUrl": "https://example.com/remoteAssistanceSessionUrl/",
"remoteAssistanceSessionErrorDetails": "Remote Assistance Session Error Details value",
"isEncrypted": true,
"userPrincipalName": "User Principal Name value",
"model": "Model value",
"manufacturer": "Manufacturer value",
"imei": "Imei value",
"complianceGracePeriodExpirationDateTime": "2016-12-31T23:56:44.951111-08:00",
"serialNumber": "Serial Number value",
"phoneNumber": "Phone Number value",
"androidSecurityPatchLevel": "Android Security Patch Level value",
"userDisplayName": "User Display Name value",
"configurationManagerClientEnabledFeatures": {
"@odata.type": "microsoft.graph.configurationManagerClientEnabledFeatures",
"inventory": true,
"modernApps": true,
"resourceAccess": true,
"deviceConfiguration": true,
"compliancePolicy": true,
"windowsUpdateForBusiness": true
},
"wiFiMacAddress": "Wi Fi Mac Address value",
"deviceHealthAttestationState": {
"@odata.type": "microsoft.graph.deviceHealthAttestationState",
"lastUpdateDateTime": "Last Update Date Time value",
"contentNamespaceUrl": "https://example.com/contentNamespaceUrl/",
"deviceHealthAttestationStatus": "Device Health Attestation Status value",
"contentVersion": "Content Version value",
"issuedDateTime": "2016-12-31T23:58:22.1231038-08:00",
"attestationIdentityKey": "Attestation Identity Key value",
"resetCount": 10,
"restartCount": 12,
"dataExcutionPolicy": "Data Excution Policy value",
"bitLockerStatus": "Bit Locker Status value",
"bootManagerVersion": "Boot Manager Version value",
"codeIntegrityCheckVersion": "Code Integrity Check Version value",
"secureBoot": "Secure Boot value",
"bootDebugging": "Boot Debugging value",
"operatingSystemKernelDebugging": "Operating System Kernel Debugging value",
"codeIntegrity": "Code Integrity value",
"testSigning": "Test Signing value",
"safeMode": "Safe Mode value",
"windowsPE": "Windows PE value",
"earlyLaunchAntiMalwareDriverProtection": "Early Launch Anti Malware Driver Protection value",
"virtualSecureMode": "Virtual Secure Mode value",
"pcrHashAlgorithm": "Pcr Hash Algorithm value",
"bootAppSecurityVersion": "Boot App Security Version value",
"bootManagerSecurityVersion": "Boot Manager Security Version value",
"tpmVersion": "Tpm Version value",
"pcr0": "Pcr0 value",
"secureBootConfigurationPolicyFingerPrint": "Secure Boot Configuration Policy Finger Print value",
"codeIntegrityPolicy": "Code Integrity Policy value",
"bootRevisionListInfo": "Boot Revision List Info value",
"operatingSystemRevListInfo": "Operating System Rev List Info value",
"healthStatusMismatchInfo": "Health Status Mismatch Info value",
"healthAttestationSupportedStatus": "Health Attestation Supported Status value"
},
"subscriberCarrier": "Subscriber Carrier value",
"meid": "Meid value",
"totalStorageSpaceInBytes": 8,
"freeStorageSpaceInBytes": 7,
"managedDeviceName": "Managed Device Name value",
"partnerReportedThreatState": "activated",
"requireUserEnrollmentApproval": true,
"managementCertificateExpirationDate": "2016-12-31T23:57:59.9789653-08:00",
"iccid": "Iccid value",
"udid": "Udid value",
"notes": "Notes value",
"ethernetMacAddress": "Ethernet Mac Address value",
"physicalMemoryInBytes": 5,
"enrollmentProfileName": "Enrollment Profile Name value"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new ManagedDevice
{
OdataType = "#microsoft.graph.managedDevice",
UserId = "User Id value",
DeviceName = "Device Name value",
ManagedDeviceOwnerType = ManagedDeviceOwnerType.Company,
DeviceActionResults = new List<DeviceActionResult>
{
new DeviceActionResult
{
OdataType = "microsoft.graph.deviceActionResult",
ActionName = "Action Name value",
ActionState = ActionState.Pending,
StartDateTime = DateTimeOffset.Parse("2016-12-31T23:58:46.7156189-08:00"),
LastUpdatedDateTime = DateTimeOffset.Parse("2017-01-01T00:00:56.8321556-08:00"),
},
},
EnrolledDateTime = DateTimeOffset.Parse("2016-12-31T23:59:43.797191-08:00"),
LastSyncDateTime = DateTimeOffset.Parse("2017-01-01T00:02:49.3205976-08:00"),
OperatingSystem = "Operating System value",
ComplianceState = ComplianceState.Compliant,
JailBroken = "Jail Broken value",
ManagementAgent = ManagementAgentType.Mdm,
OsVersion = "Os Version value",
EasActivated = true,
EasDeviceId = "Eas Device Id value",
EasActivationDateTime = DateTimeOffset.Parse("2016-12-31T23:59:43.4878784-08:00"),
AzureADRegistered = true,
DeviceEnrollmentType = DeviceEnrollmentType.UserEnrollment,
ActivationLockBypassCode = "Activation Lock Bypass Code value",
EmailAddress = "Email Address value",
AzureADDeviceId = "Azure ADDevice Id value",
DeviceRegistrationState = DeviceRegistrationState.Registered,
DeviceCategoryDisplayName = "Device Category Display Name value",
IsSupervised = true,
ExchangeLastSuccessfulSyncDateTime = DateTimeOffset.Parse("2017-01-01T00:00:45.8803083-08:00"),
ExchangeAccessState = DeviceManagementExchangeAccessState.Unknown,
ExchangeAccessStateReason = DeviceManagementExchangeAccessStateReason.Unknown,
RemoteAssistanceSessionUrl = "https://example.com/remoteAssistanceSessionUrl/",
RemoteAssistanceSessionErrorDetails = "Remote Assistance Session Error Details value",
IsEncrypted = true,
UserPrincipalName = "User Principal Name value",
Model = "Model value",
Manufacturer = "Manufacturer value",
Imei = "Imei value",
ComplianceGracePeriodExpirationDateTime = DateTimeOffset.Parse("2016-12-31T23:56:44.951111-08:00"),
SerialNumber = "Serial Number value",
PhoneNumber = "Phone Number value",
AndroidSecurityPatchLevel = "Android Security Patch Level value",
UserDisplayName = "User Display Name value",
ConfigurationManagerClientEnabledFeatures = new ConfigurationManagerClientEnabledFeatures
{
OdataType = "microsoft.graph.configurationManagerClientEnabledFeatures",
Inventory = true,
ModernApps = true,
ResourceAccess = true,
DeviceConfiguration = true,
CompliancePolicy = true,
WindowsUpdateForBusiness = true,
},
WiFiMacAddress = "Wi Fi Mac Address value",
DeviceHealthAttestationState = new DeviceHealthAttestationState
{
OdataType = "microsoft.graph.deviceHealthAttestationState",
LastUpdateDateTime = "Last Update Date Time value",
ContentNamespaceUrl = "https://example.com/contentNamespaceUrl/",
DeviceHealthAttestationStatus = "Device Health Attestation Status value",
ContentVersion = "Content Version value",
IssuedDateTime = DateTimeOffset.Parse("2016-12-31T23:58:22.1231038-08:00"),
AttestationIdentityKey = "Attestation Identity Key value",
ResetCount = 10L,
RestartCount = 12L,
DataExcutionPolicy = "Data Excution Policy value",
BitLockerStatus = "Bit Locker Status value",
BootManagerVersion = "Boot Manager Version value",
CodeIntegrityCheckVersion = "Code Integrity Check Version value",
SecureBoot = "Secure Boot value",
BootDebugging = "Boot Debugging value",
OperatingSystemKernelDebugging = "Operating System Kernel Debugging value",
CodeIntegrity = "Code Integrity value",
TestSigning = "Test Signing value",
SafeMode = "Safe Mode value",
WindowsPE = "Windows PE value",
EarlyLaunchAntiMalwareDriverProtection = "Early Launch Anti Malware Driver Protection value",
VirtualSecureMode = "Virtual Secure Mode value",
PcrHashAlgorithm = "Pcr Hash Algorithm value",
BootAppSecurityVersion = "Boot App Security Version value",
BootManagerSecurityVersion = "Boot Manager Security Version value",
TpmVersion = "Tpm Version value",
Pcr0 = "Pcr0 value",
SecureBootConfigurationPolicyFingerPrint = "Secure Boot Configuration Policy Finger Print value",
CodeIntegrityPolicy = "Code Integrity Policy value",
BootRevisionListInfo = "Boot Revision List Info value",
OperatingSystemRevListInfo = "Operating System Rev List Info value",
HealthStatusMismatchInfo = "Health Status Mismatch Info value",
HealthAttestationSupportedStatus = "Health Attestation Supported Status value",
},
SubscriberCarrier = "Subscriber Carrier value",
Meid = "Meid value",
TotalStorageSpaceInBytes = 8L,
FreeStorageSpaceInBytes = 7L,
ManagedDeviceName = "Managed Device Name value",
PartnerReportedThreatState = ManagedDevicePartnerReportedHealthState.Activated,
RequireUserEnrollmentApproval = true,
ManagementCertificateExpirationDate = DateTimeOffset.Parse("2016-12-31T23:57:59.9789653-08:00"),
Iccid = "Iccid value",
Udid = "Udid value",
Notes = "Notes value",
EthernetMacAddress = "Ethernet Mac Address value",
PhysicalMemoryInBytes = 5L,
EnrollmentProfileName = "Enrollment Profile Name 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.ManagedDevices.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc device-management managed-devices create --body '{\
"@odata.type": "#microsoft.graph.managedDevice",\
"userId": "User Id value",\
"deviceName": "Device Name value",\
"managedDeviceOwnerType": "company",\
"deviceActionResults": [\
{\
"@odata.type": "microsoft.graph.deviceActionResult",\
"actionName": "Action Name value",\
"actionState": "pending",\
"startDateTime": "2016-12-31T23:58:46.7156189-08:00",\
"lastUpdatedDateTime": "2017-01-01T00:00:56.8321556-08:00"\
}\
],\
"enrolledDateTime": "2016-12-31T23:59:43.797191-08:00",\
"lastSyncDateTime": "2017-01-01T00:02:49.3205976-08:00",\
"operatingSystem": "Operating System value",\
"complianceState": "compliant",\
"jailBroken": "Jail Broken value",\
"managementAgent": "mdm",\
"osVersion": "Os Version value",\
"easActivated": true,\
"easDeviceId": "Eas Device Id value",\
"easActivationDateTime": "2016-12-31T23:59:43.4878784-08:00",\
"azureADRegistered": true,\
"deviceEnrollmentType": "userEnrollment",\
"activationLockBypassCode": "Activation Lock Bypass Code value",\
"emailAddress": "Email Address value",\
"azureADDeviceId": "Azure ADDevice Id value",\
"deviceRegistrationState": "registered",\
"deviceCategoryDisplayName": "Device Category Display Name value",\
"isSupervised": true,\
"exchangeLastSuccessfulSyncDateTime": "2017-01-01T00:00:45.8803083-08:00",\
"exchangeAccessState": "unknown",\
"exchangeAccessStateReason": "unknown",\
"remoteAssistanceSessionUrl": "https://example.com/remoteAssistanceSessionUrl/",\
"remoteAssistanceSessionErrorDetails": "Remote Assistance Session Error Details value",\
"isEncrypted": true,\
"userPrincipalName": "User Principal Name value",\
"model": "Model value",\
"manufacturer": "Manufacturer value",\
"imei": "Imei value",\
"complianceGracePeriodExpirationDateTime": "2016-12-31T23:56:44.951111-08:00",\
"serialNumber": "Serial Number value",\
"phoneNumber": "Phone Number value",\
"androidSecurityPatchLevel": "Android Security Patch Level value",\
"userDisplayName": "User Display Name value",\
"configurationManagerClientEnabledFeatures": {\
"@odata.type": "microsoft.graph.configurationManagerClientEnabledFeatures",\
"inventory": true,\
"modernApps": true,\
"resourceAccess": true,\
"deviceConfiguration": true,\
"compliancePolicy": true,\
"windowsUpdateForBusiness": true\
},\
"wiFiMacAddress": "Wi Fi Mac Address value",\
"deviceHealthAttestationState": {\
"@odata.type": "microsoft.graph.deviceHealthAttestationState",\
"lastUpdateDateTime": "Last Update Date Time value",\
"contentNamespaceUrl": "https://example.com/contentNamespaceUrl/",\
"deviceHealthAttestationStatus": "Device Health Attestation Status value",\
"contentVersion": "Content Version value",\
"issuedDateTime": "2016-12-31T23:58:22.1231038-08:00",\
"attestationIdentityKey": "Attestation Identity Key value",\
"resetCount": 10,\
"restartCount": 12,\
"dataExcutionPolicy": "Data Excution Policy value",\
"bitLockerStatus": "Bit Locker Status value",\
"bootManagerVersion": "Boot Manager Version value",\
"codeIntegrityCheckVersion": "Code Integrity Check Version value",\
"secureBoot": "Secure Boot value",\
"bootDebugging": "Boot Debugging value",\
"operatingSystemKernelDebugging": "Operating System Kernel Debugging value",\
"codeIntegrity": "Code Integrity value",\
"testSigning": "Test Signing value",\
"safeMode": "Safe Mode value",\
"windowsPE": "Windows PE value",\
"earlyLaunchAntiMalwareDriverProtection": "Early Launch Anti Malware Driver Protection value",\
"virtualSecureMode": "Virtual Secure Mode value",\
"pcrHashAlgorithm": "Pcr Hash Algorithm value",\
"bootAppSecurityVersion": "Boot App Security Version value",\
"bootManagerSecurityVersion": "Boot Manager Security Version value",\
"tpmVersion": "Tpm Version value",\
"pcr0": "Pcr0 value",\
"secureBootConfigurationPolicyFingerPrint": "Secure Boot Configuration Policy Finger Print value",\
"codeIntegrityPolicy": "Code Integrity Policy value",\
"bootRevisionListInfo": "Boot Revision List Info value",\
"operatingSystemRevListInfo": "Operating System Rev List Info value",\
"healthStatusMismatchInfo": "Health Status Mismatch Info value",\
"healthAttestationSupportedStatus": "Health Attestation Supported Status value"\
},\
"subscriberCarrier": "Subscriber Carrier value",\
"meid": "Meid value",\
"totalStorageSpaceInBytes": 8,\
"freeStorageSpaceInBytes": 7,\
"managedDeviceName": "Managed Device Name value",\
"partnerReportedThreatState": "activated",\
"requireUserEnrollmentApproval": true,\
"managementCertificateExpirationDate": "2016-12-31T23:57:59.9789653-08:00",\
"iccid": "Iccid value",\
"udid": "Udid value",\
"notes": "Notes value",\
"ethernetMacAddress": "Ethernet Mac Address value",\
"physicalMemoryInBytes": 5, \
"enrollmentProfileName": "Enrollment Profile Name value"\
}\
'
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"
"time"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewManagedDevice()
userId := "User Id value"
requestBody.SetUserId(&userId)
deviceName := "Device Name value"
requestBody.SetDeviceName(&deviceName)
managedDeviceOwnerType := graphmodels.COMPANY_MANAGEDDEVICEOWNERTYPE
requestBody.SetManagedDeviceOwnerType(&managedDeviceOwnerType)
deviceActionResult := graphmodels.NewDeviceActionResult()
actionName := "Action Name value"
deviceActionResult.SetActionName(&actionName)
actionState := graphmodels.PENDING_ACTIONSTATE
deviceActionResult.SetActionState(&actionState)
startDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:58:46.7156189-08:00")
deviceActionResult.SetStartDateTime(&startDateTime)
lastUpdatedDateTime , err := time.Parse(time.RFC3339, "2017-01-01T00:00:56.8321556-08:00")
deviceActionResult.SetLastUpdatedDateTime(&lastUpdatedDateTime)
deviceActionResults := []graphmodels.DeviceActionResultable {
deviceActionResult,
}
requestBody.SetDeviceActionResults(deviceActionResults)
enrolledDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:59:43.797191-08:00")
requestBody.SetEnrolledDateTime(&enrolledDateTime)
lastSyncDateTime , err := time.Parse(time.RFC3339, "2017-01-01T00:02:49.3205976-08:00")
requestBody.SetLastSyncDateTime(&lastSyncDateTime)
operatingSystem := "Operating System value"
requestBody.SetOperatingSystem(&operatingSystem)
complianceState := graphmodels.COMPLIANT_COMPLIANCESTATE
requestBody.SetComplianceState(&complianceState)
jailBroken := "Jail Broken value"
requestBody.SetJailBroken(&jailBroken)
managementAgent := graphmodels.MDM_MANAGEMENTAGENTTYPE
requestBody.SetManagementAgent(&managementAgent)
osVersion := "Os Version value"
requestBody.SetOsVersion(&osVersion)
easActivated := true
requestBody.SetEasActivated(&easActivated)
easDeviceId := "Eas Device Id value"
requestBody.SetEasDeviceId(&easDeviceId)
easActivationDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:59:43.4878784-08:00")
requestBody.SetEasActivationDateTime(&easActivationDateTime)
azureADRegistered := true
requestBody.SetAzureADRegistered(&azureADRegistered)
deviceEnrollmentType := graphmodels.USERENROLLMENT_DEVICEENROLLMENTTYPE
requestBody.SetDeviceEnrollmentType(&deviceEnrollmentType)
activationLockBypassCode := "Activation Lock Bypass Code value"
requestBody.SetActivationLockBypassCode(&activationLockBypassCode)
emailAddress := "Email Address value"
requestBody.SetEmailAddress(&emailAddress)
azureADDeviceId := "Azure ADDevice Id value"
requestBody.SetAzureADDeviceId(&azureADDeviceId)
deviceRegistrationState := graphmodels.REGISTERED_DEVICEREGISTRATIONSTATE
requestBody.SetDeviceRegistrationState(&deviceRegistrationState)
deviceCategoryDisplayName := "Device Category Display Name value"
requestBody.SetDeviceCategoryDisplayName(&deviceCategoryDisplayName)
isSupervised := true
requestBody.SetIsSupervised(&isSupervised)
exchangeLastSuccessfulSyncDateTime , err := time.Parse(time.RFC3339, "2017-01-01T00:00:45.8803083-08:00")
requestBody.SetExchangeLastSuccessfulSyncDateTime(&exchangeLastSuccessfulSyncDateTime)
exchangeAccessState := graphmodels.UNKNOWN_DEVICEMANAGEMENTEXCHANGEACCESSSTATE
requestBody.SetExchangeAccessState(&exchangeAccessState)
exchangeAccessStateReason := graphmodels.UNKNOWN_DEVICEMANAGEMENTEXCHANGEACCESSSTATEREASON
requestBody.SetExchangeAccessStateReason(&exchangeAccessStateReason)
remoteAssistanceSessionUrl := "https://example.com/remoteAssistanceSessionUrl/"
requestBody.SetRemoteAssistanceSessionUrl(&remoteAssistanceSessionUrl)
remoteAssistanceSessionErrorDetails := "Remote Assistance Session Error Details value"
requestBody.SetRemoteAssistanceSessionErrorDetails(&remoteAssistanceSessionErrorDetails)
isEncrypted := true
requestBody.SetIsEncrypted(&isEncrypted)
userPrincipalName := "User Principal Name value"
requestBody.SetUserPrincipalName(&userPrincipalName)
model := "Model value"
requestBody.SetModel(&model)
manufacturer := "Manufacturer value"
requestBody.SetManufacturer(&manufacturer)
imei := "Imei value"
requestBody.SetImei(&imei)
complianceGracePeriodExpirationDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:56:44.951111-08:00")
requestBody.SetComplianceGracePeriodExpirationDateTime(&complianceGracePeriodExpirationDateTime)
serialNumber := "Serial Number value"
requestBody.SetSerialNumber(&serialNumber)
phoneNumber := "Phone Number value"
requestBody.SetPhoneNumber(&phoneNumber)
androidSecurityPatchLevel := "Android Security Patch Level value"
requestBody.SetAndroidSecurityPatchLevel(&androidSecurityPatchLevel)
userDisplayName := "User Display Name value"
requestBody.SetUserDisplayName(&userDisplayName)
configurationManagerClientEnabledFeatures := graphmodels.NewConfigurationManagerClientEnabledFeatures()
inventory := true
configurationManagerClientEnabledFeatures.SetInventory(&inventory)
modernApps := true
configurationManagerClientEnabledFeatures.SetModernApps(&modernApps)
resourceAccess := true
configurationManagerClientEnabledFeatures.SetResourceAccess(&resourceAccess)
deviceConfiguration := true
configurationManagerClientEnabledFeatures.SetDeviceConfiguration(&deviceConfiguration)
compliancePolicy := true
configurationManagerClientEnabledFeatures.SetCompliancePolicy(&compliancePolicy)
windowsUpdateForBusiness := true
configurationManagerClientEnabledFeatures.SetWindowsUpdateForBusiness(&windowsUpdateForBusiness)
requestBody.SetConfigurationManagerClientEnabledFeatures(configurationManagerClientEnabledFeatures)
wiFiMacAddress := "Wi Fi Mac Address value"
requestBody.SetWiFiMacAddress(&wiFiMacAddress)
deviceHealthAttestationState := graphmodels.NewDeviceHealthAttestationState()
lastUpdateDateTime := "Last Update Date Time value"
deviceHealthAttestationState.SetLastUpdateDateTime(&lastUpdateDateTime)
contentNamespaceUrl := "https://example.com/contentNamespaceUrl/"
deviceHealthAttestationState.SetContentNamespaceUrl(&contentNamespaceUrl)
deviceHealthAttestationStatus := "Device Health Attestation Status value"
deviceHealthAttestationState.SetDeviceHealthAttestationStatus(&deviceHealthAttestationStatus)
contentVersion := "Content Version value"
deviceHealthAttestationState.SetContentVersion(&contentVersion)
issuedDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:58:22.1231038-08:00")
deviceHealthAttestationState.SetIssuedDateTime(&issuedDateTime)
attestationIdentityKey := "Attestation Identity Key value"
deviceHealthAttestationState.SetAttestationIdentityKey(&attestationIdentityKey)
resetCount := int64(10)
deviceHealthAttestationState.SetResetCount(&resetCount)
restartCount := int64(12)
deviceHealthAttestationState.SetRestartCount(&restartCount)
dataExcutionPolicy := "Data Excution Policy value"
deviceHealthAttestationState.SetDataExcutionPolicy(&dataExcutionPolicy)
bitLockerStatus := "Bit Locker Status value"
deviceHealthAttestationState.SetBitLockerStatus(&bitLockerStatus)
bootManagerVersion := "Boot Manager Version value"
deviceHealthAttestationState.SetBootManagerVersion(&bootManagerVersion)
codeIntegrityCheckVersion := "Code Integrity Check Version value"
deviceHealthAttestationState.SetCodeIntegrityCheckVersion(&codeIntegrityCheckVersion)
secureBoot := "Secure Boot value"
deviceHealthAttestationState.SetSecureBoot(&secureBoot)
bootDebugging := "Boot Debugging value"
deviceHealthAttestationState.SetBootDebugging(&bootDebugging)
operatingSystemKernelDebugging := "Operating System Kernel Debugging value"
deviceHealthAttestationState.SetOperatingSystemKernelDebugging(&operatingSystemKernelDebugging)
codeIntegrity := "Code Integrity value"
deviceHealthAttestationState.SetCodeIntegrity(&codeIntegrity)
testSigning := "Test Signing value"
deviceHealthAttestationState.SetTestSigning(&testSigning)
safeMode := "Safe Mode value"
deviceHealthAttestationState.SetSafeMode(&safeMode)
windowsPE := "Windows PE value"
deviceHealthAttestationState.SetWindowsPE(&windowsPE)
earlyLaunchAntiMalwareDriverProtection := "Early Launch Anti Malware Driver Protection value"
deviceHealthAttestationState.SetEarlyLaunchAntiMalwareDriverProtection(&earlyLaunchAntiMalwareDriverProtection)
virtualSecureMode := "Virtual Secure Mode value"
deviceHealthAttestationState.SetVirtualSecureMode(&virtualSecureMode)
pcrHashAlgorithm := "Pcr Hash Algorithm value"
deviceHealthAttestationState.SetPcrHashAlgorithm(&pcrHashAlgorithm)
bootAppSecurityVersion := "Boot App Security Version value"
deviceHealthAttestationState.SetBootAppSecurityVersion(&bootAppSecurityVersion)
bootManagerSecurityVersion := "Boot Manager Security Version value"
deviceHealthAttestationState.SetBootManagerSecurityVersion(&bootManagerSecurityVersion)
tpmVersion := "Tpm Version value"
deviceHealthAttestationState.SetTpmVersion(&tpmVersion)
pcr0 := "Pcr0 value"
deviceHealthAttestationState.SetPcr0(&pcr0)
secureBootConfigurationPolicyFingerPrint := "Secure Boot Configuration Policy Finger Print value"
deviceHealthAttestationState.SetSecureBootConfigurationPolicyFingerPrint(&secureBootConfigurationPolicyFingerPrint)
codeIntegrityPolicy := "Code Integrity Policy value"
deviceHealthAttestationState.SetCodeIntegrityPolicy(&codeIntegrityPolicy)
bootRevisionListInfo := "Boot Revision List Info value"
deviceHealthAttestationState.SetBootRevisionListInfo(&bootRevisionListInfo)
operatingSystemRevListInfo := "Operating System Rev List Info value"
deviceHealthAttestationState.SetOperatingSystemRevListInfo(&operatingSystemRevListInfo)
healthStatusMismatchInfo := "Health Status Mismatch Info value"
deviceHealthAttestationState.SetHealthStatusMismatchInfo(&healthStatusMismatchInfo)
healthAttestationSupportedStatus := "Health Attestation Supported Status value"
deviceHealthAttestationState.SetHealthAttestationSupportedStatus(&healthAttestationSupportedStatus)
requestBody.SetDeviceHealthAttestationState(deviceHealthAttestationState)
subscriberCarrier := "Subscriber Carrier value"
requestBody.SetSubscriberCarrier(&subscriberCarrier)
meid := "Meid value"
requestBody.SetMeid(&meid)
totalStorageSpaceInBytes := int64(8)
requestBody.SetTotalStorageSpaceInBytes(&totalStorageSpaceInBytes)
freeStorageSpaceInBytes := int64(7)
requestBody.SetFreeStorageSpaceInBytes(&freeStorageSpaceInBytes)
managedDeviceName := "Managed Device Name value"
requestBody.SetManagedDeviceName(&managedDeviceName)
partnerReportedThreatState := graphmodels.ACTIVATED_MANAGEDDEVICEPARTNERREPORTEDHEALTHSTATE
requestBody.SetPartnerReportedThreatState(&partnerReportedThreatState)
requireUserEnrollmentApproval := true
requestBody.SetRequireUserEnrollmentApproval(&requireUserEnrollmentApproval)
managementCertificateExpirationDate , err := time.Parse(time.RFC3339, "2016-12-31T23:57:59.9789653-08:00")
requestBody.SetManagementCertificateExpirationDate(&managementCertificateExpirationDate)
iccid := "Iccid value"
requestBody.SetIccid(&iccid)
udid := "Udid value"
requestBody.SetUdid(&udid)
notes := "Notes value"
requestBody.SetNotes(¬es)
ethernetMacAddress := "Ethernet Mac Address value"
requestBody.SetEthernetMacAddress(ðernetMacAddress)
physicalMemoryInBytes := int64(5)
requestBody.SetPhysicalMemoryInBytes(&physicalMemoryInBytes)
enrollmentProfileName := "Enrollment Profile Name value"
requestBody.SetEnrollmentProfileName(&enrollmentProfileName)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
managedDevices, err := graphClient.DeviceManagement().ManagedDevices().Post(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);
ManagedDevice managedDevice = new ManagedDevice();
managedDevice.setOdataType("#microsoft.graph.managedDevice");
managedDevice.setUserId("User Id value");
managedDevice.setDeviceName("Device Name value");
managedDevice.setManagedDeviceOwnerType(ManagedDeviceOwnerType.Company);
LinkedList<DeviceActionResult> deviceActionResults = new LinkedList<DeviceActionResult>();
DeviceActionResult deviceActionResult = new DeviceActionResult();
deviceActionResult.setOdataType("microsoft.graph.deviceActionResult");
deviceActionResult.setActionName("Action Name value");
deviceActionResult.setActionState(ActionState.Pending);
OffsetDateTime startDateTime = OffsetDateTime.parse("2016-12-31T23:58:46.7156189-08:00");
deviceActionResult.setStartDateTime(startDateTime);
OffsetDateTime lastUpdatedDateTime = OffsetDateTime.parse("2017-01-01T00:00:56.8321556-08:00");
deviceActionResult.setLastUpdatedDateTime(lastUpdatedDateTime);
deviceActionResults.add(deviceActionResult);
managedDevice.setDeviceActionResults(deviceActionResults);
OffsetDateTime enrolledDateTime = OffsetDateTime.parse("2016-12-31T23:59:43.797191-08:00");
managedDevice.setEnrolledDateTime(enrolledDateTime);
OffsetDateTime lastSyncDateTime = OffsetDateTime.parse("2017-01-01T00:02:49.3205976-08:00");
managedDevice.setLastSyncDateTime(lastSyncDateTime);
managedDevice.setOperatingSystem("Operating System value");
managedDevice.setComplianceState(ComplianceState.Compliant);
managedDevice.setJailBroken("Jail Broken value");
managedDevice.setManagementAgent(ManagementAgentType.Mdm);
managedDevice.setOsVersion("Os Version value");
managedDevice.setEasActivated(true);
managedDevice.setEasDeviceId("Eas Device Id value");
OffsetDateTime easActivationDateTime = OffsetDateTime.parse("2016-12-31T23:59:43.4878784-08:00");
managedDevice.setEasActivationDateTime(easActivationDateTime);
managedDevice.setAzureADRegistered(true);
managedDevice.setDeviceEnrollmentType(DeviceEnrollmentType.UserEnrollment);
managedDevice.setActivationLockBypassCode("Activation Lock Bypass Code value");
managedDevice.setEmailAddress("Email Address value");
managedDevice.setAzureADDeviceId("Azure ADDevice Id value");
managedDevice.setDeviceRegistrationState(DeviceRegistrationState.Registered);
managedDevice.setDeviceCategoryDisplayName("Device Category Display Name value");
managedDevice.setIsSupervised(true);
OffsetDateTime exchangeLastSuccessfulSyncDateTime = OffsetDateTime.parse("2017-01-01T00:00:45.8803083-08:00");
managedDevice.setExchangeLastSuccessfulSyncDateTime(exchangeLastSuccessfulSyncDateTime);
managedDevice.setExchangeAccessState(DeviceManagementExchangeAccessState.Unknown);
managedDevice.setExchangeAccessStateReason(DeviceManagementExchangeAccessStateReason.Unknown);
managedDevice.setRemoteAssistanceSessionUrl("https://example.com/remoteAssistanceSessionUrl/");
managedDevice.setRemoteAssistanceSessionErrorDetails("Remote Assistance Session Error Details value");
managedDevice.setIsEncrypted(true);
managedDevice.setUserPrincipalName("User Principal Name value");
managedDevice.setModel("Model value");
managedDevice.setManufacturer("Manufacturer value");
managedDevice.setImei("Imei value");
OffsetDateTime complianceGracePeriodExpirationDateTime = OffsetDateTime.parse("2016-12-31T23:56:44.951111-08:00");
managedDevice.setComplianceGracePeriodExpirationDateTime(complianceGracePeriodExpirationDateTime);
managedDevice.setSerialNumber("Serial Number value");
managedDevice.setPhoneNumber("Phone Number value");
managedDevice.setAndroidSecurityPatchLevel("Android Security Patch Level value");
managedDevice.setUserDisplayName("User Display Name value");
ConfigurationManagerClientEnabledFeatures configurationManagerClientEnabledFeatures = new ConfigurationManagerClientEnabledFeatures();
configurationManagerClientEnabledFeatures.setOdataType("microsoft.graph.configurationManagerClientEnabledFeatures");
configurationManagerClientEnabledFeatures.setInventory(true);
configurationManagerClientEnabledFeatures.setModernApps(true);
configurationManagerClientEnabledFeatures.setResourceAccess(true);
configurationManagerClientEnabledFeatures.setDeviceConfiguration(true);
configurationManagerClientEnabledFeatures.setCompliancePolicy(true);
configurationManagerClientEnabledFeatures.setWindowsUpdateForBusiness(true);
managedDevice.setConfigurationManagerClientEnabledFeatures(configurationManagerClientEnabledFeatures);
managedDevice.setWiFiMacAddress("Wi Fi Mac Address value");
DeviceHealthAttestationState deviceHealthAttestationState = new DeviceHealthAttestationState();
deviceHealthAttestationState.setOdataType("microsoft.graph.deviceHealthAttestationState");
deviceHealthAttestationState.setLastUpdateDateTime("Last Update Date Time value");
deviceHealthAttestationState.setContentNamespaceUrl("https://example.com/contentNamespaceUrl/");
deviceHealthAttestationState.setDeviceHealthAttestationStatus("Device Health Attestation Status value");
deviceHealthAttestationState.setContentVersion("Content Version value");
OffsetDateTime issuedDateTime = OffsetDateTime.parse("2016-12-31T23:58:22.1231038-08:00");
deviceHealthAttestationState.setIssuedDateTime(issuedDateTime);
deviceHealthAttestationState.setAttestationIdentityKey("Attestation Identity Key value");
deviceHealthAttestationState.setResetCount(10L);
deviceHealthAttestationState.setRestartCount(12L);
deviceHealthAttestationState.setDataExcutionPolicy("Data Excution Policy value");
deviceHealthAttestationState.setBitLockerStatus("Bit Locker Status value");
deviceHealthAttestationState.setBootManagerVersion("Boot Manager Version value");
deviceHealthAttestationState.setCodeIntegrityCheckVersion("Code Integrity Check Version value");
deviceHealthAttestationState.setSecureBoot("Secure Boot value");
deviceHealthAttestationState.setBootDebugging("Boot Debugging value");
deviceHealthAttestationState.setOperatingSystemKernelDebugging("Operating System Kernel Debugging value");
deviceHealthAttestationState.setCodeIntegrity("Code Integrity value");
deviceHealthAttestationState.setTestSigning("Test Signing value");
deviceHealthAttestationState.setSafeMode("Safe Mode value");
deviceHealthAttestationState.setWindowsPE("Windows PE value");
deviceHealthAttestationState.setEarlyLaunchAntiMalwareDriverProtection("Early Launch Anti Malware Driver Protection value");
deviceHealthAttestationState.setVirtualSecureMode("Virtual Secure Mode value");
deviceHealthAttestationState.setPcrHashAlgorithm("Pcr Hash Algorithm value");
deviceHealthAttestationState.setBootAppSecurityVersion("Boot App Security Version value");
deviceHealthAttestationState.setBootManagerSecurityVersion("Boot Manager Security Version value");
deviceHealthAttestationState.setTpmVersion("Tpm Version value");
deviceHealthAttestationState.setPcr0("Pcr0 value");
deviceHealthAttestationState.setSecureBootConfigurationPolicyFingerPrint("Secure Boot Configuration Policy Finger Print value");
deviceHealthAttestationState.setCodeIntegrityPolicy("Code Integrity Policy value");
deviceHealthAttestationState.setBootRevisionListInfo("Boot Revision List Info value");
deviceHealthAttestationState.setOperatingSystemRevListInfo("Operating System Rev List Info value");
deviceHealthAttestationState.setHealthStatusMismatchInfo("Health Status Mismatch Info value");
deviceHealthAttestationState.setHealthAttestationSupportedStatus("Health Attestation Supported Status value");
managedDevice.setDeviceHealthAttestationState(deviceHealthAttestationState);
managedDevice.setSubscriberCarrier("Subscriber Carrier value");
managedDevice.setMeid("Meid value");
managedDevice.setTotalStorageSpaceInBytes(8L);
managedDevice.setFreeStorageSpaceInBytes(7L);
managedDevice.setManagedDeviceName("Managed Device Name value");
managedDevice.setPartnerReportedThreatState(ManagedDevicePartnerReportedHealthState.Activated);
managedDevice.setRequireUserEnrollmentApproval(true);
OffsetDateTime managementCertificateExpirationDate = OffsetDateTime.parse("2016-12-31T23:57:59.9789653-08:00");
managedDevice.setManagementCertificateExpirationDate(managementCertificateExpirationDate);
managedDevice.setIccid("Iccid value");
managedDevice.setUdid("Udid value");
managedDevice.setNotes("Notes value");
managedDevice.setEthernetMacAddress("Ethernet Mac Address value");
managedDevice.setPhysicalMemoryInBytes(5L);
managedDevice.setEnrollmentProfileName("Enrollment Profile Name value");
ManagedDevice result = graphClient.deviceManagement().managedDevices().post(managedDevice);
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 managedDevice = {
'@odata.type': '#microsoft.graph.managedDevice',
userId: 'User Id value',
deviceName: 'Device Name value',
managedDeviceOwnerType: 'company',
deviceActionResults: [
{
'@odata.type': 'microsoft.graph.deviceActionResult',
actionName: 'Action Name value',
actionState: 'pending',
startDateTime: '2016-12-31T23:58:46.7156189-08:00',
lastUpdatedDateTime: '2017-01-01T00:00:56.8321556-08:00'
}
],
enrolledDateTime: '2016-12-31T23:59:43.797191-08:00',
lastSyncDateTime: '2017-01-01T00:02:49.3205976-08:00',
operatingSystem: 'Operating System value',
complianceState: 'compliant',
jailBroken: 'Jail Broken value',
managementAgent: 'mdm',
osVersion: 'Os Version value',
easActivated: true,
easDeviceId: 'Eas Device Id value',
easActivationDateTime: '2016-12-31T23:59:43.4878784-08:00',
azureADRegistered: true,
deviceEnrollmentType: 'userEnrollment',
activationLockBypassCode: 'Activation Lock Bypass Code value',
emailAddress: 'Email Address value',
azureADDeviceId: 'Azure ADDevice Id value',
deviceRegistrationState: 'registered',
deviceCategoryDisplayName: 'Device Category Display Name value',
isSupervised: true,
exchangeLastSuccessfulSyncDateTime: '2017-01-01T00:00:45.8803083-08:00',
exchangeAccessState: 'unknown',
exchangeAccessStateReason: 'unknown',
remoteAssistanceSessionUrl: 'https://example.com/remoteAssistanceSessionUrl/',
remoteAssistanceSessionErrorDetails: 'Remote Assistance Session Error Details value',
isEncrypted: true,
userPrincipalName: 'User Principal Name value',
model: 'Model value',
manufacturer: 'Manufacturer value',
imei: 'Imei value',
complianceGracePeriodExpirationDateTime: '2016-12-31T23:56:44.951111-08:00',
serialNumber: 'Serial Number value',
phoneNumber: 'Phone Number value',
androidSecurityPatchLevel: 'Android Security Patch Level value',
userDisplayName: 'User Display Name value',
configurationManagerClientEnabledFeatures: {
'@odata.type': 'microsoft.graph.configurationManagerClientEnabledFeatures',
inventory: true,
modernApps: true,
resourceAccess: true,
deviceConfiguration: true,
compliancePolicy: true,
windowsUpdateForBusiness: true
},
wiFiMacAddress: 'Wi Fi Mac Address value',
deviceHealthAttestationState: {
'@odata.type': 'microsoft.graph.deviceHealthAttestationState',
lastUpdateDateTime: 'Last Update Date Time value',
contentNamespaceUrl: 'https://example.com/contentNamespaceUrl/',
deviceHealthAttestationStatus: 'Device Health Attestation Status value',
contentVersion: 'Content Version value',
issuedDateTime: '2016-12-31T23:58:22.1231038-08:00',
attestationIdentityKey: 'Attestation Identity Key value',
resetCount: 10,
restartCount: 12,
dataExcutionPolicy: 'Data Excution Policy value',
bitLockerStatus: 'Bit Locker Status value',
bootManagerVersion: 'Boot Manager Version value',
codeIntegrityCheckVersion: 'Code Integrity Check Version value',
secureBoot: 'Secure Boot value',
bootDebugging: 'Boot Debugging value',
operatingSystemKernelDebugging: 'Operating System Kernel Debugging value',
codeIntegrity: 'Code Integrity value',
testSigning: 'Test Signing value',
safeMode: 'Safe Mode value',
windowsPE: 'Windows PE value',
earlyLaunchAntiMalwareDriverProtection: 'Early Launch Anti Malware Driver Protection value',
virtualSecureMode: 'Virtual Secure Mode value',
pcrHashAlgorithm: 'Pcr Hash Algorithm value',
bootAppSecurityVersion: 'Boot App Security Version value',
bootManagerSecurityVersion: 'Boot Manager Security Version value',
tpmVersion: 'Tpm Version value',
pcr0: 'Pcr0 value',
secureBootConfigurationPolicyFingerPrint: 'Secure Boot Configuration Policy Finger Print value',
codeIntegrityPolicy: 'Code Integrity Policy value',
bootRevisionListInfo: 'Boot Revision List Info value',
operatingSystemRevListInfo: 'Operating System Rev List Info value',
healthStatusMismatchInfo: 'Health Status Mismatch Info value',
healthAttestationSupportedStatus: 'Health Attestation Supported Status value'
},
subscriberCarrier: 'Subscriber Carrier value',
meid: 'Meid value',
totalStorageSpaceInBytes: 8,
freeStorageSpaceInBytes: 7,
managedDeviceName: 'Managed Device Name value',
partnerReportedThreatState: 'activated',
requireUserEnrollmentApproval: true,
managementCertificateExpirationDate: '2016-12-31T23:57:59.9789653-08:00',
iccid: 'Iccid value',
udid: 'Udid value',
notes: 'Notes value',
ethernetMacAddress: 'Ethernet Mac Address value',
physicalMemoryInBytes: 5,
enrollmentProfileName: 'Enrollment Profile Name value'
};
await client.api('/deviceManagement/managedDevices')
.post(managedDevice);
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\ManagedDevice;
use Microsoft\Graph\Generated\Models\ManagedDeviceOwnerType;
use Microsoft\Graph\Generated\Models\DeviceActionResult;
use Microsoft\Graph\Generated\Models\ActionState;
use Microsoft\Graph\Generated\Models\ComplianceState;
use Microsoft\Graph\Generated\Models\ManagementAgentType;
use Microsoft\Graph\Generated\Models\DeviceEnrollmentType;
use Microsoft\Graph\Generated\Models\DeviceRegistrationState;
use Microsoft\Graph\Generated\Models\DeviceManagementExchangeAccessState;
use Microsoft\Graph\Generated\Models\DeviceManagementExchangeAccessStateReason;
use Microsoft\Graph\Generated\Models\ConfigurationManagerClientEnabledFeatures;
use Microsoft\Graph\Generated\Models\DeviceHealthAttestationState;
use Microsoft\Graph\Generated\Models\ManagedDevicePartnerReportedHealthState;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ManagedDevice();
$requestBody->setOdataType('#microsoft.graph.managedDevice');
$requestBody->setUserId('User Id value');
$requestBody->setDeviceName('Device Name value');
$requestBody->setManagedDeviceOwnerType(new ManagedDeviceOwnerType('company'));
$deviceActionResultsDeviceActionResult1 = new DeviceActionResult();
$deviceActionResultsDeviceActionResult1->setOdataType('microsoft.graph.deviceActionResult');
$deviceActionResultsDeviceActionResult1->setActionName('Action Name value');
$deviceActionResultsDeviceActionResult1->setActionState(new ActionState('pending'));
$deviceActionResultsDeviceActionResult1->setStartDateTime(new \DateTime('2016-12-31T23:58:46.7156189-08:00'));
$deviceActionResultsDeviceActionResult1->setLastUpdatedDateTime(new \DateTime('2017-01-01T00:00:56.8321556-08:00'));
$deviceActionResultsArray []= $deviceActionResultsDeviceActionResult1;
$requestBody->setDeviceActionResults($deviceActionResultsArray);
$requestBody->setEnrolledDateTime(new \DateTime('2016-12-31T23:59:43.797191-08:00'));
$requestBody->setLastSyncDateTime(new \DateTime('2017-01-01T00:02:49.3205976-08:00'));
$requestBody->setOperatingSystem('Operating System value');
$requestBody->setComplianceState(new ComplianceState('compliant'));
$requestBody->setJailBroken('Jail Broken value');
$requestBody->setManagementAgent(new ManagementAgentType('mdm'));
$requestBody->setOsVersion('Os Version value');
$requestBody->setEasActivated(true);
$requestBody->setEasDeviceId('Eas Device Id value');
$requestBody->setEasActivationDateTime(new \DateTime('2016-12-31T23:59:43.4878784-08:00'));
$requestBody->setAzureADRegistered(true);
$requestBody->setDeviceEnrollmentType(new DeviceEnrollmentType('userEnrollment'));
$requestBody->setActivationLockBypassCode('Activation Lock Bypass Code value');
$requestBody->setEmailAddress('Email Address value');
$requestBody->setAzureADDeviceId('Azure ADDevice Id value');
$requestBody->setDeviceRegistrationState(new DeviceRegistrationState('registered'));
$requestBody->setDeviceCategoryDisplayName('Device Category Display Name value');
$requestBody->setIsSupervised(true);
$requestBody->setExchangeLastSuccessfulSyncDateTime(new \DateTime('2017-01-01T00:00:45.8803083-08:00'));
$requestBody->setExchangeAccessState(new DeviceManagementExchangeAccessState('unknown'));
$requestBody->setExchangeAccessStateReason(new DeviceManagementExchangeAccessStateReason('unknown'));
$requestBody->setRemoteAssistanceSessionUrl('https://example.com/remoteAssistanceSessionUrl/');
$requestBody->setRemoteAssistanceSessionErrorDetails('Remote Assistance Session Error Details value');
$requestBody->setIsEncrypted(true);
$requestBody->setUserPrincipalName('User Principal Name value');
$requestBody->setModel('Model value');
$requestBody->setManufacturer('Manufacturer value');
$requestBody->setImei('Imei value');
$requestBody->setComplianceGracePeriodExpirationDateTime(new \DateTime('2016-12-31T23:56:44.951111-08:00'));
$requestBody->setSerialNumber('Serial Number value');
$requestBody->setPhoneNumber('Phone Number value');
$requestBody->setAndroidSecurityPatchLevel('Android Security Patch Level value');
$requestBody->setUserDisplayName('User Display Name value');
$configurationManagerClientEnabledFeatures = new ConfigurationManagerClientEnabledFeatures();
$configurationManagerClientEnabledFeatures->setOdataType('microsoft.graph.configurationManagerClientEnabledFeatures');
$configurationManagerClientEnabledFeatures->setInventory(true);
$configurationManagerClientEnabledFeatures->setModernApps(true);
$configurationManagerClientEnabledFeatures->setResourceAccess(true);
$configurationManagerClientEnabledFeatures->setDeviceConfiguration(true);
$configurationManagerClientEnabledFeatures->setCompliancePolicy(true);
$configurationManagerClientEnabledFeatures->setWindowsUpdateForBusiness(true);
$requestBody->setConfigurationManagerClientEnabledFeatures($configurationManagerClientEnabledFeatures);
$requestBody->setWiFiMacAddress('Wi Fi Mac Address value');
$deviceHealthAttestationState = new DeviceHealthAttestationState();
$deviceHealthAttestationState->setOdataType('microsoft.graph.deviceHealthAttestationState');
$deviceHealthAttestationState->setLastUpdateDateTime('Last Update Date Time value');
$deviceHealthAttestationState->setContentNamespaceUrl('https://example.com/contentNamespaceUrl/');
$deviceHealthAttestationState->setDeviceHealthAttestationStatus('Device Health Attestation Status value');
$deviceHealthAttestationState->setContentVersion('Content Version value');
$deviceHealthAttestationState->setIssuedDateTime(new \DateTime('2016-12-31T23:58:22.1231038-08:00'));
$deviceHealthAttestationState->setAttestationIdentityKey('Attestation Identity Key value');
$deviceHealthAttestationState->setResetCount(10);
$deviceHealthAttestationState->setRestartCount(12);
$deviceHealthAttestationState->setDataExcutionPolicy('Data Excution Policy value');
$deviceHealthAttestationState->setBitLockerStatus('Bit Locker Status value');
$deviceHealthAttestationState->setBootManagerVersion('Boot Manager Version value');
$deviceHealthAttestationState->setCodeIntegrityCheckVersion('Code Integrity Check Version value');
$deviceHealthAttestationState->setSecureBoot('Secure Boot value');
$deviceHealthAttestationState->setBootDebugging('Boot Debugging value');
$deviceHealthAttestationState->setOperatingSystemKernelDebugging('Operating System Kernel Debugging value');
$deviceHealthAttestationState->setCodeIntegrity('Code Integrity value');
$deviceHealthAttestationState->setTestSigning('Test Signing value');
$deviceHealthAttestationState->setSafeMode('Safe Mode value');
$deviceHealthAttestationState->setWindowsPE('Windows PE value');
$deviceHealthAttestationState->setEarlyLaunchAntiMalwareDriverProtection('Early Launch Anti Malware Driver Protection value');
$deviceHealthAttestationState->setVirtualSecureMode('Virtual Secure Mode value');
$deviceHealthAttestationState->setPcrHashAlgorithm('Pcr Hash Algorithm value');
$deviceHealthAttestationState->setBootAppSecurityVersion('Boot App Security Version value');
$deviceHealthAttestationState->setBootManagerSecurityVersion('Boot Manager Security Version value');
$deviceHealthAttestationState->setTpmVersion('Tpm Version value');
$deviceHealthAttestationState->setPcr0('Pcr0 value');
$deviceHealthAttestationState->setSecureBootConfigurationPolicyFingerPrint('Secure Boot Configuration Policy Finger Print value');
$deviceHealthAttestationState->setCodeIntegrityPolicy('Code Integrity Policy value');
$deviceHealthAttestationState->setBootRevisionListInfo('Boot Revision List Info value');
$deviceHealthAttestationState->setOperatingSystemRevListInfo('Operating System Rev List Info value');
$deviceHealthAttestationState->setHealthStatusMismatchInfo('Health Status Mismatch Info value');
$deviceHealthAttestationState->setHealthAttestationSupportedStatus('Health Attestation Supported Status value');
$requestBody->setDeviceHealthAttestationState($deviceHealthAttestationState);
$requestBody->setSubscriberCarrier('Subscriber Carrier value');
$requestBody->setMeid('Meid value');
$requestBody->setTotalStorageSpaceInBytes(8);
$requestBody->setFreeStorageSpaceInBytes(7);
$requestBody->setManagedDeviceName('Managed Device Name value');
$requestBody->setPartnerReportedThreatState(new ManagedDevicePartnerReportedHealthState('activated'));
$requestBody->setRequireUserEnrollmentApproval(true);
$requestBody->setManagementCertificateExpirationDate(new \DateTime('2016-12-31T23:57:59.9789653-08:00'));
$requestBody->setIccid('Iccid value');
$requestBody->setUdid('Udid value');
$requestBody->setNotes('Notes value');
$requestBody->setEthernetMacAddress('Ethernet Mac Address value');
$requestBody->setPhysicalMemoryInBytes(5);
$requestBody->setEnrollmentProfileName('Enrollment Profile Name value');
$result = $graphServiceClient->deviceManagement()->managedDevices()->post($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
$params = @{
"@odata.type" = "#microsoft.graph.managedDevice"
userId = "User Id value"
deviceName = "Device Name value"
managedDeviceOwnerType = "company"
deviceActionResults = @(
@{
"@odata.type" = "microsoft.graph.deviceActionResult"
actionName = "Action Name value"
actionState = "pending"
startDateTime = [System.DateTime]::Parse("2016-12-31T23:58:46.7156189-08:00")
lastUpdatedDateTime = [System.DateTime]::Parse("2017-01-01T00:00:56.8321556-08:00")
}
)
enrolledDateTime = [System.DateTime]::Parse("2016-12-31T23:59:43.797191-08:00")
lastSyncDateTime = [System.DateTime]::Parse("2017-01-01T00:02:49.3205976-08:00")
operatingSystem = "Operating System value"
complianceState = "compliant"
jailBroken = "Jail Broken value"
managementAgent = "mdm"
osVersion = "Os Version value"
easActivated = $true
easDeviceId = "Eas Device Id value"
easActivationDateTime = [System.DateTime]::Parse("2016-12-31T23:59:43.4878784-08:00")
azureADRegistered = $true
deviceEnrollmentType = "userEnrollment"
activationLockBypassCode = "Activation Lock Bypass Code value"
emailAddress = "Email Address value"
azureADDeviceId = "Azure ADDevice Id value"
deviceRegistrationState = "registered"
deviceCategoryDisplayName = "Device Category Display Name value"
isSupervised = $true
exchangeLastSuccessfulSyncDateTime = [System.DateTime]::Parse("2017-01-01T00:00:45.8803083-08:00")
exchangeAccessState = "unknown"
exchangeAccessStateReason = "unknown"
remoteAssistanceSessionUrl = "https://example.com/remoteAssistanceSessionUrl/"
remoteAssistanceSessionErrorDetails = "Remote Assistance Session Error Details value"
isEncrypted = $true
userPrincipalName = "User Principal Name value"
model = "Model value"
manufacturer = "Manufacturer value"
imei = "Imei value"
complianceGracePeriodExpirationDateTime = [System.DateTime]::Parse("2016-12-31T23:56:44.951111-08:00")
serialNumber = "Serial Number value"
phoneNumber = "Phone Number value"
androidSecurityPatchLevel = "Android Security Patch Level value"
userDisplayName = "User Display Name value"
configurationManagerClientEnabledFeatures = @{
"@odata.type" = "microsoft.graph.configurationManagerClientEnabledFeatures"
inventory = $true
modernApps = $true
resourceAccess = $true
deviceConfiguration = $true
compliancePolicy = $true
windowsUpdateForBusiness = $true
}
wiFiMacAddress = "Wi Fi Mac Address value"
deviceHealthAttestationState = @{
"@odata.type" = "microsoft.graph.deviceHealthAttestationState"
lastUpdateDateTime = "Last Update Date Time value"
contentNamespaceUrl = "https://example.com/contentNamespaceUrl/"
deviceHealthAttestationStatus = "Device Health Attestation Status value"
contentVersion = "Content Version value"
issuedDateTime = [System.DateTime]::Parse("2016-12-31T23:58:22.1231038-08:00")
attestationIdentityKey = "Attestation Identity Key value"
resetCount = 10
restartCount = 12
dataExcutionPolicy = "Data Excution Policy value"
bitLockerStatus = "Bit Locker Status value"
bootManagerVersion = "Boot Manager Version value"
codeIntegrityCheckVersion = "Code Integrity Check Version value"
secureBoot = "Secure Boot value"
bootDebugging = "Boot Debugging value"
operatingSystemKernelDebugging = "Operating System Kernel Debugging value"
codeIntegrity = "Code Integrity value"
testSigning = "Test Signing value"
safeMode = "Safe Mode value"
windowsPE = "Windows PE value"
earlyLaunchAntiMalwareDriverProtection = "Early Launch Anti Malware Driver Protection value"
virtualSecureMode = "Virtual Secure Mode value"
pcrHashAlgorithm = "Pcr Hash Algorithm value"
bootAppSecurityVersion = "Boot App Security Version value"
bootManagerSecurityVersion = "Boot Manager Security Version value"
tpmVersion = "Tpm Version value"
pcr0 = "Pcr0 value"
secureBootConfigurationPolicyFingerPrint = "Secure Boot Configuration Policy Finger Print value"
codeIntegrityPolicy = "Code Integrity Policy value"
bootRevisionListInfo = "Boot Revision List Info value"
operatingSystemRevListInfo = "Operating System Rev List Info value"
healthStatusMismatchInfo = "Health Status Mismatch Info value"
healthAttestationSupportedStatus = "Health Attestation Supported Status value"
}
subscriberCarrier = "Subscriber Carrier value"
meid = "Meid value"
totalStorageSpaceInBytes = 8
freeStorageSpaceInBytes = 7
managedDeviceName = "Managed Device Name value"
partnerReportedThreatState = "activated"
requireUserEnrollmentApproval = $true
managementCertificateExpirationDate = [System.DateTime]::Parse("2016-12-31T23:57:59.9789653-08:00")
iccid = "Iccid value"
udid = "Udid value"
notes = "Notes value"
ethernetMacAddress = "Ethernet Mac Address value"
physicalMemoryInBytes = 5
enrollmentProfileName = "Enrollment Profile Name value"
}
New-MgDeviceManagementManagedDevice -BodyParameter $params
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.models.managed_device import ManagedDevice
from msgraph.generated.models.managed_device_owner_type import ManagedDeviceOwnerType
from msgraph.generated.models.device_action_result import DeviceActionResult
from msgraph.generated.models.action_state import ActionState
from msgraph.generated.models.compliance_state import ComplianceState
from msgraph.generated.models.management_agent_type import ManagementAgentType
from msgraph.generated.models.device_enrollment_type import DeviceEnrollmentType
from msgraph.generated.models.device_registration_state import DeviceRegistrationState
from msgraph.generated.models.device_management_exchange_access_state import DeviceManagementExchangeAccessState
from msgraph.generated.models.device_management_exchange_access_state_reason import DeviceManagementExchangeAccessStateReason
from msgraph.generated.models.configuration_manager_client_enabled_features import ConfigurationManagerClientEnabledFeatures
from msgraph.generated.models.device_health_attestation_state import DeviceHealthAttestationState
from msgraph.generated.models.managed_device_partner_reported_health_state import ManagedDevicePartnerReportedHealthState
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ManagedDevice(
odata_type = "#microsoft.graph.managedDevice",
user_id = "User Id value",
device_name = "Device Name value",
managed_device_owner_type = ManagedDeviceOwnerType.Company,
device_action_results = [
DeviceActionResult(
odata_type = "microsoft.graph.deviceActionResult",
action_name = "Action Name value",
action_state = ActionState.Pending,
start_date_time = "2016-12-31T23:58:46.7156189-08:00",
last_updated_date_time = "2017-01-01T00:00:56.8321556-08:00",
),
],
enrolled_date_time = "2016-12-31T23:59:43.797191-08:00",
last_sync_date_time = "2017-01-01T00:02:49.3205976-08:00",
operating_system = "Operating System value",
compliance_state = ComplianceState.Compliant,
jail_broken = "Jail Broken value",
management_agent = ManagementAgentType.Mdm,
os_version = "Os Version value",
eas_activated = True,
eas_device_id = "Eas Device Id value",
eas_activation_date_time = "2016-12-31T23:59:43.4878784-08:00",
azure_a_d_registered = True,
device_enrollment_type = DeviceEnrollmentType.UserEnrollment,
activation_lock_bypass_code = "Activation Lock Bypass Code value",
email_address = "Email Address value",
azure_a_d_device_id = "Azure ADDevice Id value",
device_registration_state = DeviceRegistrationState.Registered,
device_category_display_name = "Device Category Display Name value",
is_supervised = True,
exchange_last_successful_sync_date_time = "2017-01-01T00:00:45.8803083-08:00",
exchange_access_state = DeviceManagementExchangeAccessState.Unknown,
exchange_access_state_reason = DeviceManagementExchangeAccessStateReason.Unknown,
remote_assistance_session_url = "https://example.com/remoteAssistanceSessionUrl/",
remote_assistance_session_error_details = "Remote Assistance Session Error Details value",
is_encrypted = True,
user_principal_name = "User Principal Name value",
model = "Model value",
manufacturer = "Manufacturer value",
imei = "Imei value",
compliance_grace_period_expiration_date_time = "2016-12-31T23:56:44.951111-08:00",
serial_number = "Serial Number value",
phone_number = "Phone Number value",
android_security_patch_level = "Android Security Patch Level value",
user_display_name = "User Display Name value",
configuration_manager_client_enabled_features = ConfigurationManagerClientEnabledFeatures(
odata_type = "microsoft.graph.configurationManagerClientEnabledFeatures",
inventory = True,
modern_apps = True,
resource_access = True,
device_configuration = True,
compliance_policy = True,
windows_update_for_business = True,
),
wi_fi_mac_address = "Wi Fi Mac Address value",
device_health_attestation_state = DeviceHealthAttestationState(
odata_type = "microsoft.graph.deviceHealthAttestationState",
last_update_date_time = "Last Update Date Time value",
content_namespace_url = "https://example.com/contentNamespaceUrl/",
device_health_attestation_status = "Device Health Attestation Status value",
content_version = "Content Version value",
issued_date_time = "2016-12-31T23:58:22.1231038-08:00",
attestation_identity_key = "Attestation Identity Key value",
reset_count = 10,
restart_count = 12,
data_excution_policy = "Data Excution Policy value",
bit_locker_status = "Bit Locker Status value",
boot_manager_version = "Boot Manager Version value",
code_integrity_check_version = "Code Integrity Check Version value",
secure_boot = "Secure Boot value",
boot_debugging = "Boot Debugging value",
operating_system_kernel_debugging = "Operating System Kernel Debugging value",
code_integrity = "Code Integrity value",
test_signing = "Test Signing value",
safe_mode = "Safe Mode value",
windows_p_e = "Windows PE value",
early_launch_anti_malware_driver_protection = "Early Launch Anti Malware Driver Protection value",
virtual_secure_mode = "Virtual Secure Mode value",
pcr_hash_algorithm = "Pcr Hash Algorithm value",
boot_app_security_version = "Boot App Security Version value",
boot_manager_security_version = "Boot Manager Security Version value",
tpm_version = "Tpm Version value",
pcr0 = "Pcr0 value",
secure_boot_configuration_policy_finger_print = "Secure Boot Configuration Policy Finger Print value",
code_integrity_policy = "Code Integrity Policy value",
boot_revision_list_info = "Boot Revision List Info value",
operating_system_rev_list_info = "Operating System Rev List Info value",
health_status_mismatch_info = "Health Status Mismatch Info value",
health_attestation_supported_status = "Health Attestation Supported Status value",
),
subscriber_carrier = "Subscriber Carrier value",
meid = "Meid value",
total_storage_space_in_bytes = 8,
free_storage_space_in_bytes = 7,
managed_device_name = "Managed Device Name value",
partner_reported_threat_state = ManagedDevicePartnerReportedHealthState.Activated,
require_user_enrollment_approval = True,
management_certificate_expiration_date = "2016-12-31T23:57:59.9789653-08:00",
iccid = "Iccid value",
udid = "Udid value",
notes = "Notes value",
ethernet_mac_address = "Ethernet Mac Address value",
physical_memory_in_bytes = 5,
enrollment_profile_name = "Enrollment Profile Name value",
)
result = await graph_client.device_management.managed_devices.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
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.