Namespace: microsoft.graph
Note: The Microsoft Graph API for Intune requires an active Intune license for the tenant.
Create a new windowsAutopilotDeviceIdentity 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 |
Delegated (personal Microsoft account) |
Not supported. |
Application |
DeviceManagementServiceConfig.ReadWrite.All |
HTTP Request
POST /deviceManagement/windowsAutopilotDeviceIdentities
Request body
In the request body, supply a JSON representation for the windowsAutopilotDeviceIdentity object.
The following table shows the properties that are required when you create the windowsAutopilotDeviceIdentity.
Property |
Type |
Description |
id |
String |
The GUID for the object |
groupTag |
String |
Group Tag of the Windows autopilot device. |
purchaseOrderIdentifier |
String |
Purchase Order Identifier of the Windows autopilot device. |
serialNumber |
String |
Serial number of the Windows autopilot device. |
productKey |
String |
Product Key of the Windows autopilot device. |
manufacturer |
String |
Oem manufacturer of the Windows autopilot device. |
model |
String |
Model name of the Windows autopilot device. |
enrollmentState |
enrollmentState |
Intune enrollment state of the Windows autopilot device. Possible values are: unknown , enrolled , pendingReset , failed , notContacted . |
lastContactedDateTime |
DateTimeOffset |
Intune Last Contacted Date Time of the Windows autopilot device. |
addressableUserName |
String |
Addressable user name. |
userPrincipalName |
String |
User Principal Name. |
resourceName |
String |
Resource Name. |
skuNumber |
String |
SKU Number |
systemFamily |
String |
System Family |
azureActiveDirectoryDeviceId |
String |
AAD Device ID - to be deprecated |
managedDeviceId |
String |
Managed Device ID |
displayName |
String |
Display Name |
Response
If successful, this method returns a 201 Created
response code and a windowsAutopilotDeviceIdentity object in the response body.
Example
Request
Here is an example of the request.
POST https://graph.microsoft.com/v1.0/deviceManagement/windowsAutopilotDeviceIdentities
Content-type: application/json
Content-length: 814
{
"@odata.type": "#microsoft.graph.windowsAutopilotDeviceIdentity",
"groupTag": "Group Tag value",
"purchaseOrderIdentifier": "Purchase Order Identifier value",
"serialNumber": "Serial Number value",
"productKey": "Product Key value",
"manufacturer": "Manufacturer value",
"model": "Model value",
"enrollmentState": "enrolled",
"lastContactedDateTime": "2016-12-31T23:58:44.2908994-08:00",
"addressableUserName": "Addressable User Name value",
"userPrincipalName": "User Principal Name value",
"resourceName": "Resource Name value",
"skuNumber": "Sku Number value",
"systemFamily": "System Family value",
"azureActiveDirectoryDeviceId": "Azure Active Directory Device Id value",
"managedDeviceId": "Managed Device Id value",
"displayName": "Display Name value"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new WindowsAutopilotDeviceIdentity
{
OdataType = "#microsoft.graph.windowsAutopilotDeviceIdentity",
GroupTag = "Group Tag value",
PurchaseOrderIdentifier = "Purchase Order Identifier value",
SerialNumber = "Serial Number value",
ProductKey = "Product Key value",
Manufacturer = "Manufacturer value",
Model = "Model value",
EnrollmentState = EnrollmentState.Enrolled,
LastContactedDateTime = DateTimeOffset.Parse("2016-12-31T23:58:44.2908994-08:00"),
AddressableUserName = "Addressable User Name value",
UserPrincipalName = "User Principal Name value",
ResourceName = "Resource Name value",
SkuNumber = "Sku Number value",
SystemFamily = "System Family value",
AzureActiveDirectoryDeviceId = "Azure Active Directory Device Id value",
ManagedDeviceId = "Managed Device Id value",
DisplayName = "Display 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.WindowsAutopilotDeviceIdentities.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 windows-autopilot-device-identities create --body '{\
"@odata.type": "#microsoft.graph.windowsAutopilotDeviceIdentity",\
"groupTag": "Group Tag value",\
"purchaseOrderIdentifier": "Purchase Order Identifier value",\
"serialNumber": "Serial Number value",\
"productKey": "Product Key value",\
"manufacturer": "Manufacturer value",\
"model": "Model value",\
"enrollmentState": "enrolled",\
"lastContactedDateTime": "2016-12-31T23:58:44.2908994-08:00",\
"addressableUserName": "Addressable User Name value",\
"userPrincipalName": "User Principal Name value",\
"resourceName": "Resource Name value",\
"skuNumber": "Sku Number value",\
"systemFamily": "System Family value",\
"azureActiveDirectoryDeviceId": "Azure Active Directory Device Id value",\
"managedDeviceId": "Managed Device Id value",\
"displayName": "Display 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.NewWindowsAutopilotDeviceIdentity()
groupTag := "Group Tag value"
requestBody.SetGroupTag(&groupTag)
purchaseOrderIdentifier := "Purchase Order Identifier value"
requestBody.SetPurchaseOrderIdentifier(&purchaseOrderIdentifier)
serialNumber := "Serial Number value"
requestBody.SetSerialNumber(&serialNumber)
productKey := "Product Key value"
requestBody.SetProductKey(&productKey)
manufacturer := "Manufacturer value"
requestBody.SetManufacturer(&manufacturer)
model := "Model value"
requestBody.SetModel(&model)
enrollmentState := graphmodels.ENROLLED_ENROLLMENTSTATE
requestBody.SetEnrollmentState(&enrollmentState)
lastContactedDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:58:44.2908994-08:00")
requestBody.SetLastContactedDateTime(&lastContactedDateTime)
addressableUserName := "Addressable User Name value"
requestBody.SetAddressableUserName(&addressableUserName)
userPrincipalName := "User Principal Name value"
requestBody.SetUserPrincipalName(&userPrincipalName)
resourceName := "Resource Name value"
requestBody.SetResourceName(&resourceName)
skuNumber := "Sku Number value"
requestBody.SetSkuNumber(&skuNumber)
systemFamily := "System Family value"
requestBody.SetSystemFamily(&systemFamily)
azureActiveDirectoryDeviceId := "Azure Active Directory Device Id value"
requestBody.SetAzureActiveDirectoryDeviceId(&azureActiveDirectoryDeviceId)
managedDeviceId := "Managed Device Id value"
requestBody.SetManagedDeviceId(&managedDeviceId)
displayName := "Display Name value"
requestBody.SetDisplayName(&displayName)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
windowsAutopilotDeviceIdentities, err := graphClient.DeviceManagement().WindowsAutopilotDeviceIdentities().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);
WindowsAutopilotDeviceIdentity windowsAutopilotDeviceIdentity = new WindowsAutopilotDeviceIdentity();
windowsAutopilotDeviceIdentity.setOdataType("#microsoft.graph.windowsAutopilotDeviceIdentity");
windowsAutopilotDeviceIdentity.setGroupTag("Group Tag value");
windowsAutopilotDeviceIdentity.setPurchaseOrderIdentifier("Purchase Order Identifier value");
windowsAutopilotDeviceIdentity.setSerialNumber("Serial Number value");
windowsAutopilotDeviceIdentity.setProductKey("Product Key value");
windowsAutopilotDeviceIdentity.setManufacturer("Manufacturer value");
windowsAutopilotDeviceIdentity.setModel("Model value");
windowsAutopilotDeviceIdentity.setEnrollmentState(EnrollmentState.Enrolled);
OffsetDateTime lastContactedDateTime = OffsetDateTime.parse("2016-12-31T23:58:44.2908994-08:00");
windowsAutopilotDeviceIdentity.setLastContactedDateTime(lastContactedDateTime);
windowsAutopilotDeviceIdentity.setAddressableUserName("Addressable User Name value");
windowsAutopilotDeviceIdentity.setUserPrincipalName("User Principal Name value");
windowsAutopilotDeviceIdentity.setResourceName("Resource Name value");
windowsAutopilotDeviceIdentity.setSkuNumber("Sku Number value");
windowsAutopilotDeviceIdentity.setSystemFamily("System Family value");
windowsAutopilotDeviceIdentity.setAzureActiveDirectoryDeviceId("Azure Active Directory Device Id value");
windowsAutopilotDeviceIdentity.setManagedDeviceId("Managed Device Id value");
windowsAutopilotDeviceIdentity.setDisplayName("Display Name value");
WindowsAutopilotDeviceIdentity result = graphClient.deviceManagement().windowsAutopilotDeviceIdentities().post(windowsAutopilotDeviceIdentity);
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 windowsAutopilotDeviceIdentity = {
'@odata.type': '#microsoft.graph.windowsAutopilotDeviceIdentity',
groupTag: 'Group Tag value',
purchaseOrderIdentifier: 'Purchase Order Identifier value',
serialNumber: 'Serial Number value',
productKey: 'Product Key value',
manufacturer: 'Manufacturer value',
model: 'Model value',
enrollmentState: 'enrolled',
lastContactedDateTime: '2016-12-31T23:58:44.2908994-08:00',
addressableUserName: 'Addressable User Name value',
userPrincipalName: 'User Principal Name value',
resourceName: 'Resource Name value',
skuNumber: 'Sku Number value',
systemFamily: 'System Family value',
azureActiveDirectoryDeviceId: 'Azure Active Directory Device Id value',
managedDeviceId: 'Managed Device Id value',
displayName: 'Display Name value'
};
await client.api('/deviceManagement/windowsAutopilotDeviceIdentities')
.post(windowsAutopilotDeviceIdentity);
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\WindowsAutopilotDeviceIdentity;
use Microsoft\Graph\Generated\Models\EnrollmentState;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new WindowsAutopilotDeviceIdentity();
$requestBody->setOdataType('#microsoft.graph.windowsAutopilotDeviceIdentity');
$requestBody->setGroupTag('Group Tag value');
$requestBody->setPurchaseOrderIdentifier('Purchase Order Identifier value');
$requestBody->setSerialNumber('Serial Number value');
$requestBody->setProductKey('Product Key value');
$requestBody->setManufacturer('Manufacturer value');
$requestBody->setModel('Model value');
$requestBody->setEnrollmentState(new EnrollmentState('enrolled'));
$requestBody->setLastContactedDateTime(new \DateTime('2016-12-31T23:58:44.2908994-08:00'));
$requestBody->setAddressableUserName('Addressable User Name value');
$requestBody->setUserPrincipalName('User Principal Name value');
$requestBody->setResourceName('Resource Name value');
$requestBody->setSkuNumber('Sku Number value');
$requestBody->setSystemFamily('System Family value');
$requestBody->setAzureActiveDirectoryDeviceId('Azure Active Directory Device Id value');
$requestBody->setManagedDeviceId('Managed Device Id value');
$requestBody->setDisplayName('Display Name value');
$result = $graphServiceClient->deviceManagement()->windowsAutopilotDeviceIdentities()->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.Enrollment
$params = @{
"@odata.type" = "#microsoft.graph.windowsAutopilotDeviceIdentity"
groupTag = "Group Tag value"
purchaseOrderIdentifier = "Purchase Order Identifier value"
serialNumber = "Serial Number value"
productKey = "Product Key value"
manufacturer = "Manufacturer value"
model = "Model value"
enrollmentState = "enrolled"
lastContactedDateTime = [System.DateTime]::Parse("2016-12-31T23:58:44.2908994-08:00")
addressableUserName = "Addressable User Name value"
userPrincipalName = "User Principal Name value"
resourceName = "Resource Name value"
skuNumber = "Sku Number value"
systemFamily = "System Family value"
azureActiveDirectoryDeviceId = "Azure Active Directory Device Id value"
managedDeviceId = "Managed Device Id value"
displayName = "Display Name value"
}
New-MgDeviceManagementWindowsAutopilotDeviceIdentity -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.windows_autopilot_device_identity import WindowsAutopilotDeviceIdentity
from msgraph.generated.models.enrollment_state import EnrollmentState
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = WindowsAutopilotDeviceIdentity(
odata_type = "#microsoft.graph.windowsAutopilotDeviceIdentity",
group_tag = "Group Tag value",
purchase_order_identifier = "Purchase Order Identifier value",
serial_number = "Serial Number value",
product_key = "Product Key value",
manufacturer = "Manufacturer value",
model = "Model value",
enrollment_state = EnrollmentState.Enrolled,
last_contacted_date_time = "2016-12-31T23:58:44.2908994-08:00",
addressable_user_name = "Addressable User Name value",
user_principal_name = "User Principal Name value",
resource_name = "Resource Name value",
sku_number = "Sku Number value",
system_family = "System Family value",
azure_active_directory_device_id = "Azure Active Directory Device Id value",
managed_device_id = "Managed Device Id value",
display_name = "Display Name value",
)
result = await graph_client.device_management.windows_autopilot_device_identities.post(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 201 Created
Content-Type: application/json
Content-Length: 863
{
"@odata.type": "#microsoft.graph.windowsAutopilotDeviceIdentity",
"id": "fac6f0b1-f0b1-fac6-b1f0-c6fab1f0c6fa",
"groupTag": "Group Tag value",
"purchaseOrderIdentifier": "Purchase Order Identifier value",
"serialNumber": "Serial Number value",
"productKey": "Product Key value",
"manufacturer": "Manufacturer value",
"model": "Model value",
"enrollmentState": "enrolled",
"lastContactedDateTime": "2016-12-31T23:58:44.2908994-08:00",
"addressableUserName": "Addressable User Name value",
"userPrincipalName": "User Principal Name value",
"resourceName": "Resource Name value",
"skuNumber": "Sku Number value",
"systemFamily": "System Family value",
"azureActiveDirectoryDeviceId": "Azure Active Directory Device Id value",
"managedDeviceId": "Managed Device Id value",
"displayName": "Display Name value"
}