Namespace: microsoft.graph
Note: The Microsoft Graph API for Intune requires an active Intune license for the tenant.
Create a new vppToken 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, DeviceManagementConfiguration.ReadWrite.All |
Delegated (personal Microsoft account) |
Not supported. |
Application |
DeviceManagementServiceConfig.ReadWrite.All, DeviceManagementConfiguration.ReadWrite.All |
HTTP Request
POST /deviceAppManagement/vppTokens
Request body
In the request body, supply a JSON representation for the vppToken object.
The following table shows the properties that are required when you create the vppToken.
Property |
Type |
Description |
id |
String |
This is automatically generated when the appleVolumePurchaseProgramToken is created. It is the Key of the entity. |
organizationName |
String |
The organization associated with the Apple Volume Purchase Program Token |
vppTokenAccountType |
vppTokenAccountType |
The type of volume purchase program which the given Apple Volume Purchase Program Token is associated with. Possible values are: business , education . Possible values are: business , education . |
appleId |
String |
The apple Id associated with the given Apple Volume Purchase Program Token. |
expirationDateTime |
DateTimeOffset |
The expiration date time of the Apple Volume Purchase Program Token. |
lastSyncDateTime |
DateTimeOffset |
The last time when an application sync was done with the Apple volume purchase program service using the the Apple Volume Purchase Program Token. |
token |
String |
The Apple Volume Purchase Program Token string downloaded from the Apple Volume Purchase Program. |
lastModifiedDateTime |
DateTimeOffset |
Last modification date time associated with the Apple Volume Purchase Program Token. |
state |
vppTokenState |
Current state of the Apple Volume Purchase Program Token. Possible values are: unknown , valid , expired , invalid , assignedToExternalMDM . Possible values are: unknown , valid , expired , invalid , assignedToExternalMDM . |
lastSyncStatus |
vppTokenSyncStatus |
Current sync status of the last application sync which was triggered using the Apple Volume Purchase Program Token. Possible values are: none , inProgress , completed , failed . Possible values are: none , inProgress , completed , failed . |
automaticallyUpdateApps |
Boolean |
Whether or not apps for the VPP token will be automatically updated. |
countryOrRegion |
String |
Whether or not apps for the VPP token will be automatically updated. |
Response
If successful, this method returns a 201 Created
response code and a vppToken object in the response body.
Example
Request
Here is an example of the request.
POST https://graph.microsoft.com/v1.0/deviceAppManagement/vppTokens
Content-type: application/json
Content-length: 461
{
"@odata.type": "#microsoft.graph.vppToken",
"organizationName": "Organization Name value",
"vppTokenAccountType": "education",
"appleId": "Apple Id value",
"expirationDateTime": "2016-12-31T23:57:57.2481234-08:00",
"lastSyncDateTime": "2017-01-01T00:02:49.3205976-08:00",
"token": "Token value",
"state": "valid",
"lastSyncStatus": "inProgress",
"automaticallyUpdateApps": true,
"countryOrRegion": "Country Or Region value"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new VppToken
{
OdataType = "#microsoft.graph.vppToken",
OrganizationName = "Organization Name value",
VppTokenAccountType = VppTokenAccountType.Education,
AppleId = "Apple Id value",
ExpirationDateTime = DateTimeOffset.Parse("2016-12-31T23:57:57.2481234-08:00"),
LastSyncDateTime = DateTimeOffset.Parse("2017-01-01T00:02:49.3205976-08:00"),
Token = "Token value",
State = VppTokenState.Valid,
LastSyncStatus = VppTokenSyncStatus.InProgress,
AutomaticallyUpdateApps = true,
CountryOrRegion = "Country Or Region value",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceAppManagement.VppTokens.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 vpp-tokens create --body '{\
"@odata.type": "#microsoft.graph.vppToken",\
"organizationName": "Organization Name value",\
"vppTokenAccountType": "education",\
"appleId": "Apple Id value",\
"expirationDateTime": "2016-12-31T23:57:57.2481234-08:00",\
"lastSyncDateTime": "2017-01-01T00:02:49.3205976-08:00",\
"token": "Token value",\
"state": "valid",\
"lastSyncStatus": "inProgress",\
"automaticallyUpdateApps": true,\
"countryOrRegion": "Country Or Region 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.NewVppToken()
organizationName := "Organization Name value"
requestBody.SetOrganizationName(&organizationName)
vppTokenAccountType := graphmodels.EDUCATION_VPPTOKENACCOUNTTYPE
requestBody.SetVppTokenAccountType(&vppTokenAccountType)
appleId := "Apple Id value"
requestBody.SetAppleId(&appleId)
expirationDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:57:57.2481234-08:00")
requestBody.SetExpirationDateTime(&expirationDateTime)
lastSyncDateTime , err := time.Parse(time.RFC3339, "2017-01-01T00:02:49.3205976-08:00")
requestBody.SetLastSyncDateTime(&lastSyncDateTime)
token := "Token value"
requestBody.SetToken(&token)
state := graphmodels.VALID_VPPTOKENSTATE
requestBody.SetState(&state)
lastSyncStatus := graphmodels.INPROGRESS_VPPTOKENSYNCSTATUS
requestBody.SetLastSyncStatus(&lastSyncStatus)
automaticallyUpdateApps := true
requestBody.SetAutomaticallyUpdateApps(&automaticallyUpdateApps)
countryOrRegion := "Country Or Region value"
requestBody.SetCountryOrRegion(&countryOrRegion)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
vppTokens, err := graphClient.DeviceAppManagement().VppTokens().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);
VppToken vppToken = new VppToken();
vppToken.setOdataType("#microsoft.graph.vppToken");
vppToken.setOrganizationName("Organization Name value");
vppToken.setVppTokenAccountType(VppTokenAccountType.Education);
vppToken.setAppleId("Apple Id value");
OffsetDateTime expirationDateTime = OffsetDateTime.parse("2016-12-31T23:57:57.2481234-08:00");
vppToken.setExpirationDateTime(expirationDateTime);
OffsetDateTime lastSyncDateTime = OffsetDateTime.parse("2017-01-01T00:02:49.3205976-08:00");
vppToken.setLastSyncDateTime(lastSyncDateTime);
vppToken.setToken("Token value");
vppToken.setState(VppTokenState.Valid);
vppToken.setLastSyncStatus(VppTokenSyncStatus.InProgress);
vppToken.setAutomaticallyUpdateApps(true);
vppToken.setCountryOrRegion("Country Or Region value");
VppToken result = graphClient.deviceAppManagement().vppTokens().post(vppToken);
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 vppToken = {
'@odata.type': '#microsoft.graph.vppToken',
organizationName: 'Organization Name value',
vppTokenAccountType: 'education',
appleId: 'Apple Id value',
expirationDateTime: '2016-12-31T23:57:57.2481234-08:00',
lastSyncDateTime: '2017-01-01T00:02:49.3205976-08:00',
token: 'Token value',
state: 'valid',
lastSyncStatus: 'inProgress',
automaticallyUpdateApps: true,
countryOrRegion: 'Country Or Region value'
};
await client.api('/deviceAppManagement/vppTokens')
.post(vppToken);
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\VppToken;
use Microsoft\Graph\Generated\Models\VppTokenAccountType;
use Microsoft\Graph\Generated\Models\VppTokenState;
use Microsoft\Graph\Generated\Models\VppTokenSyncStatus;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new VppToken();
$requestBody->setOdataType('#microsoft.graph.vppToken');
$requestBody->setOrganizationName('Organization Name value');
$requestBody->setVppTokenAccountType(new VppTokenAccountType('education'));
$requestBody->setAppleId('Apple Id value');
$requestBody->setExpirationDateTime(new \DateTime('2016-12-31T23:57:57.2481234-08:00'));
$requestBody->setLastSyncDateTime(new \DateTime('2017-01-01T00:02:49.3205976-08:00'));
$requestBody->setToken('Token value');
$requestBody->setState(new VppTokenState('valid'));
$requestBody->setLastSyncStatus(new VppTokenSyncStatus('inProgress'));
$requestBody->setAutomaticallyUpdateApps(true);
$requestBody->setCountryOrRegion('Country Or Region value');
$result = $graphServiceClient->deviceAppManagement()->vppTokens()->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.vppToken"
organizationName = "Organization Name value"
vppTokenAccountType = "education"
appleId = "Apple Id value"
expirationDateTime = [System.DateTime]::Parse("2016-12-31T23:57:57.2481234-08:00")
lastSyncDateTime = [System.DateTime]::Parse("2017-01-01T00:02:49.3205976-08:00")
token = "Token value"
state = "valid"
lastSyncStatus = "inProgress"
automaticallyUpdateApps = $true
countryOrRegion = "Country Or Region value"
}
New-MgDeviceAppManagementVppToken -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.vpp_token import VppToken
from msgraph.generated.models.vpp_token_account_type import VppTokenAccountType
from msgraph.generated.models.vpp_token_state import VppTokenState
from msgraph.generated.models.vpp_token_sync_status import VppTokenSyncStatus
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = VppToken(
odata_type = "#microsoft.graph.vppToken",
organization_name = "Organization Name value",
vpp_token_account_type = VppTokenAccountType.Education,
apple_id = "Apple Id value",
expiration_date_time = "2016-12-31T23:57:57.2481234-08:00",
last_sync_date_time = "2017-01-01T00:02:49.3205976-08:00",
token = "Token value",
state = VppTokenState.Valid,
last_sync_status = VppTokenSyncStatus.InProgress,
automatically_update_apps = True,
country_or_region = "Country Or Region value",
)
result = await graph_client.device_app_management.vpp_tokens.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: 574
{
"@odata.type": "#microsoft.graph.vppToken",
"id": "9ceb2f92-2f92-9ceb-922f-eb9c922feb9c",
"organizationName": "Organization Name value",
"vppTokenAccountType": "education",
"appleId": "Apple Id value",
"expirationDateTime": "2016-12-31T23:57:57.2481234-08:00",
"lastSyncDateTime": "2017-01-01T00:02:49.3205976-08:00",
"token": "Token value",
"lastModifiedDateTime": "2017-01-01T00:00:35.1329464-08:00",
"state": "valid",
"lastSyncStatus": "inProgress",
"automaticallyUpdateApps": true,
"countryOrRegion": "Country Or Region value"
}