Namespace: microsoft.graph.windowsUpdates
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Update the members and exclusions relationships of a deploymentAudience.
Adding an azureADDevice to the members or exclusions collections of a deployment audience automatically creates a Microsoft Entra device object, if it doesn't already exist.
If the same updatableAsset gets included in the exclusions and members collections of a deploymentAudience, the deployment doesn't apply to that asset.
If all updatableAsset objects are the same type, you can also use the method updateAudienceById to update the deploymentAudience.
Note
This API has a known issue related to deployments created via Intune.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
❌ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
WindowsUpdates.ReadWrite.All |
Not available. |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
WindowsUpdates.ReadWrite.All |
Not available. |
Important
In delegated scenarios with work or school accounts, the signed-in user must be an owner or member of the group or be assigned a supported Microsoft Entra role or a custom role with a supported role permission. Intune Administrator, or Windows Update Deployment Administrator are the least privileged roles supported for this operation.
HTTP request
POST /admin/windows/updates/deploymentAudiences/{deploymentAudienceId}/updateAudience
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 202 Accepted
response code. It doesn't return anything in the response body.
Examples
Request
POST https://graph.microsoft.com/beta/admin/windows/updates/deploymentAudiences/2d477566-6976-4c2d-97eb-d2acd1c2864e/updateAudience
Content-Type: application/json
{
"addMembers": [
{
"@odata.type": "#microsoft.graph.windowsUpdates.azureADDevice",
"id": "String (identifier)"
}
],
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Admin.Windows.Updates.DeploymentAudiences.Item.MicrosoftGraphWindowsUpdatesUpdateAudience;
using Microsoft.Graph.Beta.Models.WindowsUpdates;
var requestBody = new UpdateAudiencePostRequestBody
{
AddMembers = new List<UpdatableAsset>
{
new AzureADDevice
{
OdataType = "#microsoft.graph.windowsUpdates.azureADDevice",
Id = "String (identifier)",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Admin.Windows.Updates.DeploymentAudiences["{deploymentAudience-id}"].MicrosoftGraphWindowsUpdatesUpdateAudience.PostAsync(requestBody);
mgc-beta admin windows updates deployment-audiences microsoft-graph-windows-updates-update-audience post --deployment-audience-id {deploymentAudience-id} --body '{\
"addMembers": [\
{\
"@odata.type": "#microsoft.graph.windowsUpdates.azureADDevice",\
"id": "String (identifier)"\
}\
],\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphadmin "github.com/microsoftgraph/msgraph-beta-sdk-go/admin"
graphmodelswindowsupdates "github.com/microsoftgraph/msgraph-beta-sdk-go/models/windowsupdates"
//other-imports
)
requestBody := graphadmin.NewUpdateAudiencePostRequestBody()
updatableAsset := graphmodelswindowsupdates.NewAzureADDevice()
id := "String (identifier)"
updatableAsset.SetId(&id)
addMembers := []graphmodelswindowsupdates.UpdatableAssetable {
updatableAsset,
}
requestBody.SetAddMembers(addMembers)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Admin().Windows().Updates().DeploymentAudiences().ByDeploymentAudienceId("deploymentAudience-id").MicrosoftGraphWindowsUpdatesUpdateAudience().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.admin.windows.updates.deploymentaudiences.item.microsoftgraphwindowsupdatesupdateaudience.UpdateAudiencePostRequestBody updateAudiencePostRequestBody = new com.microsoft.graph.beta.admin.windows.updates.deploymentaudiences.item.microsoftgraphwindowsupdatesupdateaudience.UpdateAudiencePostRequestBody();
LinkedList<com.microsoft.graph.beta.models.windowsupdates.UpdatableAsset> addMembers = new LinkedList<com.microsoft.graph.beta.models.windowsupdates.UpdatableAsset>();
com.microsoft.graph.beta.models.windowsupdates.AzureADDevice updatableAsset = new com.microsoft.graph.beta.models.windowsupdates.AzureADDevice();
updatableAsset.setOdataType("#microsoft.graph.windowsUpdates.azureADDevice");
updatableAsset.setId("String (identifier)");
addMembers.add(updatableAsset);
updateAudiencePostRequestBody.setAddMembers(addMembers);
graphClient.admin().windows().updates().deploymentAudiences().byDeploymentAudienceId("{deploymentAudience-id}").microsoftGraphWindowsUpdatesUpdateAudience().post(updateAudiencePostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const updateAudience = {
addMembers: [
{
'@odata.type': '#microsoft.graph.windowsUpdates.azureADDevice',
id: 'String (identifier)'
}
],
};
await client.api('/admin/windows/updates/deploymentAudiences/2d477566-6976-4c2d-97eb-d2acd1c2864e/updateAudience')
.version('beta')
.post(updateAudience);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Admin\Windows\Updates\DeploymentAudiences\Item\MicrosoftGraphWindowsUpdatesUpdateAudience\UpdateAudiencePostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\WindowsUpdates\UpdatableAsset;
use Microsoft\Graph\Beta\Generated\Models\WindowsUpdates\AzureADDevice;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new UpdateAudiencePostRequestBody();
$addMembersUpdatableAsset1 = new AzureADDevice();
$addMembersUpdatableAsset1->setOdataType('#microsoft.graph.windowsUpdates.azureADDevice');
$addMembersUpdatableAsset1->setId('String (identifier)');
$addMembersArray []= $addMembersUpdatableAsset1;
$requestBody->setAddMembers($addMembersArray);
$graphServiceClient->admin()->windows()->updates()->deploymentAudiences()->byDeploymentAudienceId('deploymentAudience-id')->microsoftGraphWindowsUpdatesUpdateAudience()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.admin.windows.updates.deploymentaudiences.item.microsoft_graph_windows_updates_update_audience.update_audience_post_request_body import UpdateAudiencePostRequestBody
from msgraph_beta.generated.models.windows_updates.updatable_asset import UpdatableAsset
from msgraph_beta.generated.models.windows_updates.azure_a_d_device import AzureADDevice
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = UpdateAudiencePostRequestBody(
add_members = [
AzureADDevice(
odata_type = "#microsoft.graph.windowsUpdates.azureADDevice",
id = "String (identifier)",
),
],
)
await graph_client.admin.windows.updates.deployment_audiences.by_deployment_audience_id('deploymentAudience-id').microsoft_graph_windows_updates_update_audience.post(request_body)
Response
HTTP/1.1 202 Accepted