Namespace: microsoft.graph
Note: The Microsoft Graph API for Intune requires an active Intune license for the tenant.
Not yet documented
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) |
DeviceManagementManagedDevices.PrivilegedOperations.All |
Delegated (personal Microsoft account) |
Not supported. |
Application |
DeviceManagementManagedDevices.PrivilegedOperations.All |
HTTP Request
POST /deviceManagement/managedDevices/{managedDeviceId}/updateWindowsDeviceAccount
POST /deviceManagement/detectedApps/{detectedAppId}/managedDevices/{managedDeviceId}/updateWindowsDeviceAccount
POST /deviceManagement/detectedApps/{detectedAppId}/managedDevices/{managedDeviceId}/users/{userId}/managedDevices/{managedDeviceId}/updateWindowsDeviceAccount
Request body
In the request body, supply JSON representation of the parameters.
The following table shows the parameters that can be used with this action.
Response
If successful, this action returns a 204 No Content
response code.
Example
Request
Here is an example of the request.
POST https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/{managedDeviceId}/updateWindowsDeviceAccount
Content-type: application/json
Content-length: 532
{
"updateWindowsDeviceAccountActionParameter": {
"@odata.type": "microsoft.graph.updateWindowsDeviceAccountActionParameter",
"deviceAccount": {
"@odata.type": "microsoft.graph.windowsDeviceAccount",
"password": "Password value"
},
"passwordRotationEnabled": true,
"calendarSyncEnabled": true,
"deviceAccountEmail": "Device Account Email value",
"exchangeServer": "Exchange Server value",
"sessionInitiationProtocalAddress": "Session Initiation Protocal Address value"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.DeviceManagement.ManagedDevices.Item.UpdateWindowsDeviceAccount;
using Microsoft.Graph.Models;
var requestBody = new UpdateWindowsDeviceAccountPostRequestBody
{
UpdateWindowsDeviceAccountActionParameter = new UpdateWindowsDeviceAccountActionParameter
{
OdataType = "microsoft.graph.updateWindowsDeviceAccountActionParameter",
DeviceAccount = new WindowsDeviceAccount
{
OdataType = "microsoft.graph.windowsDeviceAccount",
Password = "Password value",
},
PasswordRotationEnabled = true,
CalendarSyncEnabled = true,
DeviceAccountEmail = "Device Account Email value",
ExchangeServer = "Exchange Server value",
SessionInitiationProtocalAddress = "Session Initiation Protocal Address value",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.DeviceManagement.ManagedDevices["{managedDevice-id}"].UpdateWindowsDeviceAccount.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 update-windows-device-account post --managed-device-id {managedDevice-id} --body '{\
"updateWindowsDeviceAccountActionParameter": {\
"@odata.type": "microsoft.graph.updateWindowsDeviceAccountActionParameter",\
"deviceAccount": {\
"@odata.type": "microsoft.graph.windowsDeviceAccount",\
"password": "Password value"\
},\
"passwordRotationEnabled": true,\
"calendarSyncEnabled": true,\
"deviceAccountEmail": "Device Account Email value",\
"exchangeServer": "Exchange Server value",\
"sessionInitiationProtocalAddress": "Session Initiation Protocal Address 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"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphdevicemanagement "github.com/microsoftgraph/msgraph-sdk-go/devicemanagement"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphdevicemanagement.NewUpdateWindowsDeviceAccountPostRequestBody()
updateWindowsDeviceAccountActionParameter := graphmodels.NewUpdateWindowsDeviceAccountActionParameter()
deviceAccount := graphmodels.NewWindowsDeviceAccount()
password := "Password value"
deviceAccount.SetPassword(&password)
updateWindowsDeviceAccountActionParameter.SetDeviceAccount(deviceAccount)
passwordRotationEnabled := true
updateWindowsDeviceAccountActionParameter.SetPasswordRotationEnabled(&passwordRotationEnabled)
calendarSyncEnabled := true
updateWindowsDeviceAccountActionParameter.SetCalendarSyncEnabled(&calendarSyncEnabled)
deviceAccountEmail := "Device Account Email value"
updateWindowsDeviceAccountActionParameter.SetDeviceAccountEmail(&deviceAccountEmail)
exchangeServer := "Exchange Server value"
updateWindowsDeviceAccountActionParameter.SetExchangeServer(&exchangeServer)
sessionInitiationProtocalAddress := "Session Initiation Protocal Address value"
updateWindowsDeviceAccountActionParameter.SetSessionInitiationProtocalAddress(&sessionInitiationProtocalAddress)
requestBody.SetUpdateWindowsDeviceAccountActionParameter(updateWindowsDeviceAccountActionParameter)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.DeviceManagement().ManagedDevices().ByManagedDeviceId("managedDevice-id").UpdateWindowsDeviceAccount().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);
com.microsoft.graph.devicemanagement.manageddevices.item.updatewindowsdeviceaccount.UpdateWindowsDeviceAccountPostRequestBody updateWindowsDeviceAccountPostRequestBody = new com.microsoft.graph.devicemanagement.manageddevices.item.updatewindowsdeviceaccount.UpdateWindowsDeviceAccountPostRequestBody();
UpdateWindowsDeviceAccountActionParameter updateWindowsDeviceAccountActionParameter = new UpdateWindowsDeviceAccountActionParameter();
updateWindowsDeviceAccountActionParameter.setOdataType("microsoft.graph.updateWindowsDeviceAccountActionParameter");
WindowsDeviceAccount deviceAccount = new WindowsDeviceAccount();
deviceAccount.setOdataType("microsoft.graph.windowsDeviceAccount");
deviceAccount.setPassword("Password value");
updateWindowsDeviceAccountActionParameter.setDeviceAccount(deviceAccount);
updateWindowsDeviceAccountActionParameter.setPasswordRotationEnabled(true);
updateWindowsDeviceAccountActionParameter.setCalendarSyncEnabled(true);
updateWindowsDeviceAccountActionParameter.setDeviceAccountEmail("Device Account Email value");
updateWindowsDeviceAccountActionParameter.setExchangeServer("Exchange Server value");
updateWindowsDeviceAccountActionParameter.setSessionInitiationProtocalAddress("Session Initiation Protocal Address value");
updateWindowsDeviceAccountPostRequestBody.setUpdateWindowsDeviceAccountActionParameter(updateWindowsDeviceAccountActionParameter);
graphClient.deviceManagement().managedDevices().byManagedDeviceId("{managedDevice-id}").updateWindowsDeviceAccount().post(updateWindowsDeviceAccountPostRequestBody);
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 updateWindowsDeviceAccount = {
updateWindowsDeviceAccountActionParameter: {
'@odata.type': 'microsoft.graph.updateWindowsDeviceAccountActionParameter',
deviceAccount: {
'@odata.type': 'microsoft.graph.windowsDeviceAccount',
password: 'Password value'
},
passwordRotationEnabled: true,
calendarSyncEnabled: true,
deviceAccountEmail: 'Device Account Email value',
exchangeServer: 'Exchange Server value',
sessionInitiationProtocalAddress: 'Session Initiation Protocal Address value'
}
};
await client.api('/deviceManagement/managedDevices/{managedDeviceId}/updateWindowsDeviceAccount')
.post(updateWindowsDeviceAccount);
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\DeviceManagement\ManagedDevices\Item\UpdateWindowsDeviceAccount\UpdateWindowsDeviceAccountPostRequestBody;
use Microsoft\Graph\Generated\Models\UpdateWindowsDeviceAccountActionParameter;
use Microsoft\Graph\Generated\Models\WindowsDeviceAccount;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new UpdateWindowsDeviceAccountPostRequestBody();
$updateWindowsDeviceAccountActionParameter = new UpdateWindowsDeviceAccountActionParameter();
$updateWindowsDeviceAccountActionParameter->setOdataType('microsoft.graph.updateWindowsDeviceAccountActionParameter');
$updateWindowsDeviceAccountActionParameterDeviceAccount = new WindowsDeviceAccount();
$updateWindowsDeviceAccountActionParameterDeviceAccount->setOdataType('microsoft.graph.windowsDeviceAccount');
$updateWindowsDeviceAccountActionParameterDeviceAccount->setPassword('Password value');
$updateWindowsDeviceAccountActionParameter->setDeviceAccount($updateWindowsDeviceAccountActionParameterDeviceAccount);
$updateWindowsDeviceAccountActionParameter->setPasswordRotationEnabled(true);
$updateWindowsDeviceAccountActionParameter->setCalendarSyncEnabled(true);
$updateWindowsDeviceAccountActionParameter->setDeviceAccountEmail('Device Account Email value');
$updateWindowsDeviceAccountActionParameter->setExchangeServer('Exchange Server value');
$updateWindowsDeviceAccountActionParameter->setSessionInitiationProtocalAddress('Session Initiation Protocal Address value');
$requestBody->setUpdateWindowsDeviceAccountActionParameter($updateWindowsDeviceAccountActionParameter);
$graphServiceClient->deviceManagement()->managedDevices()->byManagedDeviceId('managedDevice-id')->updateWindowsDeviceAccount()->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 = @{
updateWindowsDeviceAccountActionParameter = @{
"@odata.type" = "microsoft.graph.updateWindowsDeviceAccountActionParameter"
deviceAccount = @{
"@odata.type" = "microsoft.graph.windowsDeviceAccount"
password = "Password value"
}
passwordRotationEnabled = $true
calendarSyncEnabled = $true
deviceAccountEmail = "Device Account Email value"
exchangeServer = "Exchange Server value"
sessionInitiationProtocalAddress = "Session Initiation Protocal Address value"
}
}
Update-MgDeviceManagementManagedDeviceWindowsDeviceAccount -ManagedDeviceId $managedDeviceId -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.devicemanagement.manageddevices.item.update_windows_device_account.update_windows_device_account_post_request_body import UpdateWindowsDeviceAccountPostRequestBody
from msgraph.generated.models.update_windows_device_account_action_parameter import UpdateWindowsDeviceAccountActionParameter
from msgraph.generated.models.windows_device_account import WindowsDeviceAccount
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = UpdateWindowsDeviceAccountPostRequestBody(
update_windows_device_account_action_parameter = UpdateWindowsDeviceAccountActionParameter(
odata_type = "microsoft.graph.updateWindowsDeviceAccountActionParameter",
device_account = WindowsDeviceAccount(
odata_type = "microsoft.graph.windowsDeviceAccount",
password = "Password value",
),
password_rotation_enabled = True,
calendar_sync_enabled = True,
device_account_email = "Device Account Email value",
exchange_server = "Exchange Server value",
session_initiation_protocal_address = "Session Initiation Protocal Address value",
),
)
await graph_client.device_management.managed_devices.by_managed_device_id('managedDevice-id').update_windows_device_account.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 204 No Content