Namespace: microsoft.graph
Note: The Microsoft Graph API for Intune requires an active Intune license for the tenant.
Create a new targetedManagedAppConfiguration 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) |
DeviceManagementApps.ReadWrite.All |
Delegated (personal Microsoft account) |
Not supported. |
Application |
DeviceManagementApps.ReadWrite.All |
HTTP Request
POST /deviceAppManagement/targetedManagedAppConfigurations
Request body
In the request body, supply a JSON representation for the targetedManagedAppConfiguration object.
The following table shows the properties that are required when you create the targetedManagedAppConfiguration.
Property |
Type |
Description |
displayName |
String |
Policy display name. Inherited from managedAppPolicy |
description |
String |
The policy's description. Inherited from managedAppPolicy |
createdDateTime |
DateTimeOffset |
The date and time the policy was created. Inherited from managedAppPolicy |
lastModifiedDateTime |
DateTimeOffset |
Last time the policy was modified. Inherited from managedAppPolicy |
id |
String |
Key of the entity. Inherited from managedAppPolicy |
version |
String |
Version of the entity. Inherited from managedAppPolicy |
customSettings |
keyValuePair collection |
A set of string key and string value pairs to be sent to apps for users to whom the configuration is scoped, unalterned by this service Inherited from managedAppConfiguration |
deployedAppCount |
Int32 |
Count of apps to which the current policy is deployed. |
isAssigned |
Boolean |
Indicates if the policy is deployed to any inclusion groups or not. |
Response
If successful, this method returns a 201 Created
response code and a targetedManagedAppConfiguration object in the response body.
Example
Request
Here is an example of the request.
POST https://graph.microsoft.com/v1.0/deviceAppManagement/targetedManagedAppConfigurations
Content-type: application/json
Content-length: 388
{
"@odata.type": "#microsoft.graph.targetedManagedAppConfiguration",
"displayName": "Display Name value",
"description": "Description value",
"version": "Version value",
"customSettings": [
{
"@odata.type": "microsoft.graph.keyValuePair",
"name": "Name value",
"value": "Value value"
}
],
"deployedAppCount": 0,
"isAssigned": true
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new TargetedManagedAppConfiguration
{
OdataType = "#microsoft.graph.targetedManagedAppConfiguration",
DisplayName = "Display Name value",
Description = "Description value",
Version = "Version value",
CustomSettings = new List<KeyValuePair>
{
new KeyValuePair
{
OdataType = "microsoft.graph.keyValuePair",
Name = "Name value",
Value = "Value value",
},
},
DeployedAppCount = 0,
IsAssigned = true,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceAppManagement.TargetedManagedAppConfigurations.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc device-app-management targeted-managed-app-configurations create --body '{\
"@odata.type": "#microsoft.graph.targetedManagedAppConfiguration",\
"displayName": "Display Name value",\
"description": "Description value",\
"version": "Version value",\
"customSettings": [\
{\
"@odata.type": "microsoft.graph.keyValuePair",\
"name": "Name value",\
"value": "Value value"\
}\
],\
"deployedAppCount": 0,\
"isAssigned": true\
}\
'
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"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewTargetedManagedAppConfiguration()
displayName := "Display Name value"
requestBody.SetDisplayName(&displayName)
description := "Description value"
requestBody.SetDescription(&description)
version := "Version value"
requestBody.SetVersion(&version)
keyValuePair := graphmodels.NewKeyValuePair()
name := "Name value"
keyValuePair.SetName(&name)
value := "Value value"
keyValuePair.SetValue(&value)
customSettings := []graphmodels.KeyValuePairable {
keyValuePair,
}
requestBody.SetCustomSettings(customSettings)
deployedAppCount := int32(0)
requestBody.SetDeployedAppCount(&deployedAppCount)
isAssigned := true
requestBody.SetIsAssigned(&isAssigned)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
targetedManagedAppConfigurations, err := graphClient.DeviceAppManagement().TargetedManagedAppConfigurations().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);
TargetedManagedAppConfiguration targetedManagedAppConfiguration = new TargetedManagedAppConfiguration();
targetedManagedAppConfiguration.setOdataType("#microsoft.graph.targetedManagedAppConfiguration");
targetedManagedAppConfiguration.setDisplayName("Display Name value");
targetedManagedAppConfiguration.setDescription("Description value");
targetedManagedAppConfiguration.setVersion("Version value");
LinkedList<KeyValuePair> customSettings = new LinkedList<KeyValuePair>();
KeyValuePair keyValuePair = new KeyValuePair();
keyValuePair.setOdataType("microsoft.graph.keyValuePair");
keyValuePair.setName("Name value");
keyValuePair.setValue("Value value");
customSettings.add(keyValuePair);
targetedManagedAppConfiguration.setCustomSettings(customSettings);
targetedManagedAppConfiguration.setDeployedAppCount(0);
targetedManagedAppConfiguration.setIsAssigned(true);
TargetedManagedAppConfiguration result = graphClient.deviceAppManagement().targetedManagedAppConfigurations().post(targetedManagedAppConfiguration);
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 targetedManagedAppConfiguration = {
'@odata.type': '#microsoft.graph.targetedManagedAppConfiguration',
displayName: 'Display Name value',
description: 'Description value',
version: 'Version value',
customSettings: [
{
'@odata.type': 'microsoft.graph.keyValuePair',
name: 'Name value',
value: 'Value value'
}
],
deployedAppCount: 0,
isAssigned: true
};
await client.api('/deviceAppManagement/targetedManagedAppConfigurations')
.post(targetedManagedAppConfiguration);
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\TargetedManagedAppConfiguration;
use Microsoft\Graph\Generated\Models\KeyValuePair;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new TargetedManagedAppConfiguration();
$requestBody->setOdataType('#microsoft.graph.targetedManagedAppConfiguration');
$requestBody->setDisplayName('Display Name value');
$requestBody->setDescription('Description value');
$requestBody->setVersion('Version value');
$customSettingsKeyValuePair1 = new KeyValuePair();
$customSettingsKeyValuePair1->setOdataType('microsoft.graph.keyValuePair');
$customSettingsKeyValuePair1->setName('Name value');
$customSettingsKeyValuePair1->setValue('Value value');
$customSettingsArray []= $customSettingsKeyValuePair1;
$requestBody->setCustomSettings($customSettingsArray);
$requestBody->setDeployedAppCount(0);
$requestBody->setIsAssigned(true);
$result = $graphServiceClient->deviceAppManagement()->targetedManagedAppConfigurations()->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.Devices.CorporateManagement
$params = @{
"@odata.type" = "#microsoft.graph.targetedManagedAppConfiguration"
displayName = "Display Name value"
description = "Description value"
version = "Version value"
customSettings = @(
@{
"@odata.type" = "microsoft.graph.keyValuePair"
name = "Name value"
value = "Value value"
}
)
deployedAppCount = 0
isAssigned = $true
}
New-MgDeviceAppManagementTargetedManagedAppConfiguration -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.targeted_managed_app_configuration import TargetedManagedAppConfiguration
from msgraph.generated.models.key_value_pair import KeyValuePair
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = TargetedManagedAppConfiguration(
odata_type = "#microsoft.graph.targetedManagedAppConfiguration",
display_name = "Display Name value",
description = "Description value",
version = "Version value",
custom_settings = [
KeyValuePair(
odata_type = "microsoft.graph.keyValuePair",
name = "Name value",
value = "Value value",
),
],
deployed_app_count = 0,
is_assigned = True,
)
result = await graph_client.device_app_management.targeted_managed_app_configurations.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: 560
{
"@odata.type": "#microsoft.graph.targetedManagedAppConfiguration",
"displayName": "Display Name value",
"description": "Description value",
"createdDateTime": "2017-01-01T00:02:43.5775965-08:00",
"lastModifiedDateTime": "2017-01-01T00:00:35.1329464-08:00",
"id": "2444e029-e029-2444-29e0-442429e04424",
"version": "Version value",
"customSettings": [
{
"@odata.type": "microsoft.graph.keyValuePair",
"name": "Name value",
"value": "Value value"
}
],
"deployedAppCount": 0,
"isAssigned": true
}