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) |
DeviceManagementApps.ReadWrite.All |
Delegated (personal Microsoft account) |
Not supported. |
Application |
DeviceManagementApps.ReadWrite.All |
HTTP Request
POST /deviceAppManagement/targetedManagedAppConfigurations/{targetedManagedAppConfigurationId}/targetApps
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/deviceAppManagement/targetedManagedAppConfigurations/{targetedManagedAppConfigurationId}/targetApps
Content-type: application/json
Content-length: 378
{
"apps": [
{
"@odata.type": "#microsoft.graph.managedMobileApp",
"mobileAppIdentifier": {
"@odata.type": "microsoft.graph.androidMobileAppIdentifier",
"packageId": "Package Id value"
},
"id": "0a129715-9715-0a12-1597-120a1597120a",
"version": "Version value"
}
],
"appGroupType": "allCoreMicrosoftApps"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.DeviceAppManagement.TargetedManagedAppConfigurations.Item.TargetApps;
using Microsoft.Graph.Models;
var requestBody = new TargetAppsPostRequestBody
{
Apps = new List<ManagedMobileApp>
{
new ManagedMobileApp
{
OdataType = "#microsoft.graph.managedMobileApp",
MobileAppIdentifier = new AndroidMobileAppIdentifier
{
OdataType = "microsoft.graph.androidMobileAppIdentifier",
PackageId = "Package Id value",
},
Id = "0a129715-9715-0a12-1597-120a1597120a",
Version = "Version value",
},
},
AppGroupType = TargetedManagedAppGroupType.AllCoreMicrosoftApps,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.DeviceAppManagement.TargetedManagedAppConfigurations["{targetedManagedAppConfiguration-id}"].TargetApps.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 target-apps post --targeted-managed-app-configuration-id {targetedManagedAppConfiguration-id} --body '{\
"apps": [\
{\
"@odata.type": "#microsoft.graph.managedMobileApp",\
"mobileAppIdentifier": {\
"@odata.type": "microsoft.graph.androidMobileAppIdentifier",\
"packageId": "Package Id value"\
},\
"id": "0a129715-9715-0a12-1597-120a1597120a",\
"version": "Version value"\
}\
],\
"appGroupType": "allCoreMicrosoftApps"\
}\
'
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"
graphdeviceappmanagement "github.com/microsoftgraph/msgraph-sdk-go/deviceappmanagement"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphdeviceappmanagement.NewTargetAppsPostRequestBody()
managedMobileApp := graphmodels.NewManagedMobileApp()
mobileAppIdentifier := graphmodels.NewAndroidMobileAppIdentifier()
packageId := "Package Id value"
mobileAppIdentifier.SetPackageId(&packageId)
managedMobileApp.SetMobileAppIdentifier(mobileAppIdentifier)
id := "0a129715-9715-0a12-1597-120a1597120a"
managedMobileApp.SetId(&id)
version := "Version value"
managedMobileApp.SetVersion(&version)
apps := []graphmodels.ManagedMobileAppable {
managedMobileApp,
}
requestBody.SetApps(apps)
appGroupType := graphmodels.ALLCOREMICROSOFTAPPS_TARGETEDMANAGEDAPPGROUPTYPE
requestBody.SetAppGroupType(&appGroupType)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.DeviceAppManagement().TargetedManagedAppConfigurations().ByTargetedManagedAppConfigurationId("targetedManagedAppConfiguration-id").TargetApps().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.deviceappmanagement.targetedmanagedappconfigurations.item.targetapps.TargetAppsPostRequestBody targetAppsPostRequestBody = new com.microsoft.graph.deviceappmanagement.targetedmanagedappconfigurations.item.targetapps.TargetAppsPostRequestBody();
LinkedList<ManagedMobileApp> apps = new LinkedList<ManagedMobileApp>();
ManagedMobileApp managedMobileApp = new ManagedMobileApp();
managedMobileApp.setOdataType("#microsoft.graph.managedMobileApp");
AndroidMobileAppIdentifier mobileAppIdentifier = new AndroidMobileAppIdentifier();
mobileAppIdentifier.setOdataType("microsoft.graph.androidMobileAppIdentifier");
mobileAppIdentifier.setPackageId("Package Id value");
managedMobileApp.setMobileAppIdentifier(mobileAppIdentifier);
managedMobileApp.setId("0a129715-9715-0a12-1597-120a1597120a");
managedMobileApp.setVersion("Version value");
apps.add(managedMobileApp);
targetAppsPostRequestBody.setApps(apps);
targetAppsPostRequestBody.setAppGroupType(TargetedManagedAppGroupType.AllCoreMicrosoftApps);
graphClient.deviceAppManagement().targetedManagedAppConfigurations().byTargetedManagedAppConfigurationId("{targetedManagedAppConfiguration-id}").targetApps().post(targetAppsPostRequestBody);
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 targetApps = {
apps: [
{
'@odata.type': '#microsoft.graph.managedMobileApp',
mobileAppIdentifier: {
'@odata.type': 'microsoft.graph.androidMobileAppIdentifier',
packageId: 'Package Id value'
},
id: '0a129715-9715-0a12-1597-120a1597120a',
version: 'Version value'
}
],
appGroupType: 'allCoreMicrosoftApps'
};
await client.api('/deviceAppManagement/targetedManagedAppConfigurations/{targetedManagedAppConfigurationId}/targetApps')
.post(targetApps);
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\DeviceAppManagement\TargetedManagedAppConfigurations\Item\TargetApps\TargetAppsPostRequestBody;
use Microsoft\Graph\Generated\Models\ManagedMobileApp;
use Microsoft\Graph\Generated\Models\AndroidMobileAppIdentifier;
use Microsoft\Graph\Generated\Models\TargetedManagedAppGroupType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new TargetAppsPostRequestBody();
$appsManagedMobileApp1 = new ManagedMobileApp();
$appsManagedMobileApp1->setOdataType('#microsoft.graph.managedMobileApp');
$appsManagedMobileApp1MobileAppIdentifier = new AndroidMobileAppIdentifier();
$appsManagedMobileApp1MobileAppIdentifier->setOdataType('microsoft.graph.androidMobileAppIdentifier');
$appsManagedMobileApp1MobileAppIdentifier->setPackageId('Package Id value');
$appsManagedMobileApp1->setMobileAppIdentifier($appsManagedMobileApp1MobileAppIdentifier);
$appsManagedMobileApp1->setId('0a129715-9715-0a12-1597-120a1597120a');
$appsManagedMobileApp1->setVersion('Version value');
$appsArray []= $appsManagedMobileApp1;
$requestBody->setApps($appsArray);
$requestBody->setAppGroupType(new TargetedManagedAppGroupType('allCoreMicrosoftApps'));
$graphServiceClient->deviceAppManagement()->targetedManagedAppConfigurations()->byTargetedManagedAppConfigurationId('targetedManagedAppConfiguration-id')->targetApps()->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 = @{
apps = @(
@{
"@odata.type" = "#microsoft.graph.managedMobileApp"
mobileAppIdentifier = @{
"@odata.type" = "microsoft.graph.androidMobileAppIdentifier"
packageId = "Package Id value"
}
id = "0a129715-9715-0a12-1597-120a1597120a"
version = "Version value"
}
)
appGroupType = "allCoreMicrosoftApps"
}
Invoke-MgTargetDeviceAppManagementTargetedManagedAppConfigurationApp -TargetedManagedAppConfigurationId $targetedManagedAppConfigurationId -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.deviceappmanagement.targetedmanagedappconfigurations.item.target_apps.target_apps_post_request_body import TargetAppsPostRequestBody
from msgraph.generated.models.managed_mobile_app import ManagedMobileApp
from msgraph.generated.models.android_mobile_app_identifier import AndroidMobileAppIdentifier
from msgraph.generated.models.targeted_managed_app_group_type import TargetedManagedAppGroupType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = TargetAppsPostRequestBody(
apps = [
ManagedMobileApp(
odata_type = "#microsoft.graph.managedMobileApp",
mobile_app_identifier = AndroidMobileAppIdentifier(
odata_type = "microsoft.graph.androidMobileAppIdentifier",
package_id = "Package Id value",
),
id = "0a129715-9715-0a12-1597-120a1597120a",
version = "Version value",
),
],
app_group_type = TargetedManagedAppGroupType.AllCoreMicrosoftApps,
)
await graph_client.device_app_management.targeted_managed_app_configurations.by_targeted_managed_app_configuration_id('targetedManagedAppConfiguration-id').target_apps.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