Namespace: microsoft.graph.cloudLicensing
Wichtig
Die APIs unter der /beta Version in Microsoft Graph können sich ändern. Die Verwendung dieser APIs in Produktionsanwendungen wird nicht unterstützt. Um festzustellen, ob eine API in v1.0 verfügbar ist, verwenden Sie die Version Selektor.
Erstellen Sie eine neue Lizenzzuweisung, indem Sie in der Zuordnungssammlung eines organization veröffentlichen.
Eine Zuweisung muss immer eine direkte Beziehung zu einer Zuweisung und zu einem Benutzer oder einer Gruppe haben. Wenn eine Zuordnung durch Posten in der zentralen Zuordnungssammlung unter /admin/cloudLicensing/assignmentserstellt wird, müssen diese beiden Beziehungen im Anforderungstext eingerichtet werden. Zuweisungen können auch durch Posten in der Zuordnungssammlung eines Kontingents, in der Zuordnungssammlung eines Benutzers oder in der Zuordnungssammlung einer Gruppe erstellt werden.
Diese API ist in den folgenden nationalen Cloudbereitstellungen verfügbar.
| Weltweiter Service |
US Government L4 |
US Government L5 (DOD) |
China, betrieben von 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Berechtigungen
Wählen Sie die Berechtigungen aus, die für diese API als am wenigsten privilegiert markiert sind. Verwenden Sie eine höhere Berechtigung oder Berechtigungen nur, wenn Ihre App dies erfordert. Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen. Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz.
| Berechtigungstyp |
Berechtigungen mit den geringsten Berechtigungen |
Berechtigungen mit höheren Berechtigungen |
| Delegiert (Geschäfts-, Schul- oder Unikonto) |
CloudLicensing.AssignLicenses |
CloudLicensing.AssignLicenses.Organization, User-CloudLicensing.AssignLicenses, User-CloudLicensing.AssignLicenses.Organization, User.ReadWrite.All, Group-CloudLicensing.AssignLicenses, Group-CloudLicensing.AssignLicenses.Organization, Group.ReadWrite.All, Directory.ReadWrite.All |
| Delegiert (persönliches Microsoft-Konto) |
Nicht unterstützt |
Nicht unterstützt |
| Application |
CloudLicensing.AssignLicenses.Organization |
User-CloudLicensing.AssignLicenses.Organization, User.ReadWrite.All, Group-CloudLicensing.AssignLicenses.Organization, Group.ReadWrite.All, Directory.ReadWrite.All |
HTTP-Anforderung
POST /admin/cloudLicensing/assignments
Anforderungstext
Geben Sie im Anforderungstext eine JSON-Darstellung des Zuweisungsobjekts an.
Sie können die folgenden Eigenschaften angeben, wenn Sie eine Zuweisung erstellen.
| Eigenschaft |
Typ |
Beschreibung |
| disabledServicePlanIds |
GUID-Sammlung |
Die Liste der deaktivierten Dienstpläne für diese Zuweisung. Eine leere Liste gibt an, dass alle Dienste aktiviert sind. Erforderlich. |
Sie können die folgenden Beziehungen angeben, wenn Sie eine Zuweisung erstellen.
Antwort
Wenn die Methode erfolgreich verläuft, werden der 201 Created Antwortcode und ein microsoft.graph.cloudLicensing.assignment-Objekt im Antworttext zurückgegeben.
Beispiele
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
POST https://graph.microsoft.com/beta/admin/cloudLicensing/assignments
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.cloudLicensing.assignment",
"allotment@odata.bind": "https://graph.microsoft.com/beta/admin/cloudLicensing/allotments/rkocgef3dgjhnu3gmu2mqhbdbmwcymnf6fk3k6a7zbui5e7gfpmi",
"assignedTo@odata.bind": "https://graph.microsoft.com/beta/users/6d645c5f-089f-40d8-b0e7-136fb5c56d5b",
"disabledServicePlanIds": [
"bed136c6-b799-4462-824d-fc045d3a9d25"
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.CloudLicensing;
var requestBody = new Assignment
{
OdataType = "#microsoft.graph.cloudLicensing.assignment",
DisabledServicePlanIds = new List<Guid?>
{
Guid.Parse("bed136c6-b799-4462-824d-fc045d3a9d25"),
},
AdditionalData = new Dictionary<string, object>
{
{
"allotment@odata.bind" , "https://graph.microsoft.com/beta/admin/cloudLicensing/allotments/rkocgef3dgjhnu3gmu2mqhbdbmwcymnf6fk3k6a7zbui5e7gfpmi"
},
{
"assignedTo@odata.bind" , "https://graph.microsoft.com/beta/users/6d645c5f-089f-40d8-b0e7-136fb5c56d5b"
},
},
};
// To initialize your graphClient, see https://dotnet.territoriali.olinfo.it/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Admin.CloudLicensing.Assignments.PostAsync(requestBody);
// 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"
graphmodelscloudlicensing "github.com/microsoftgraph/msgraph-beta-sdk-go/models/cloudlicensing"
//other-imports
)
requestBody := graphmodelscloudlicensing.NewAssignment()
disabledServicePlanIds := []uuid.UUID {
uuid.MustParse("bed136c6-b799-4462-824d-fc045d3a9d25"),
}
requestBody.SetDisabledServicePlanIds(disabledServicePlanIds)
additionalData := map[string]interface{}{
"allotment@odata.bind" : "https://graph.microsoft.com/beta/admin/cloudLicensing/allotments/rkocgef3dgjhnu3gmu2mqhbdbmwcymnf6fk3k6a7zbui5e7gfpmi",
"assignedTo@odata.bind" : "https://graph.microsoft.com/beta/users/6d645c5f-089f-40d8-b0e7-136fb5c56d5b",
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://dotnet.territoriali.olinfo.it/en-us/graph/sdks/create-client?from=snippets&tabs=go
assignments, err := graphClient.Admin().CloudLicensing().Assignments().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.models.cloudlicensing.Assignment assignment = new com.microsoft.graph.beta.models.cloudlicensing.Assignment();
assignment.setOdataType("#microsoft.graph.cloudLicensing.assignment");
LinkedList<UUID> disabledServicePlanIds = new LinkedList<UUID>();
disabledServicePlanIds.add(UUID.fromString("bed136c6-b799-4462-824d-fc045d3a9d25"));
assignment.setDisabledServicePlanIds(disabledServicePlanIds);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("allotment@odata.bind", "https://graph.microsoft.com/beta/admin/cloudLicensing/allotments/rkocgef3dgjhnu3gmu2mqhbdbmwcymnf6fk3k6a7zbui5e7gfpmi");
additionalData.put("assignedTo@odata.bind", "https://graph.microsoft.com/beta/users/6d645c5f-089f-40d8-b0e7-136fb5c56d5b");
assignment.setAdditionalData(additionalData);
com.microsoft.graph.models.cloudlicensing.Assignment result = graphClient.admin().cloudLicensing().assignments().post(assignment);
const options = {
authProvider,
};
const client = Client.init(options);
const assignment = {
'@odata.type': '#microsoft.graph.cloudLicensing.assignment',
'allotment@odata.bind': 'https://graph.microsoft.com/beta/admin/cloudLicensing/allotments/rkocgef3dgjhnu3gmu2mqhbdbmwcymnf6fk3k6a7zbui5e7gfpmi',
'assignedTo@odata.bind': 'https://graph.microsoft.com/beta/users/6d645c5f-089f-40d8-b0e7-136fb5c56d5b',
disabledServicePlanIds: [
'bed136c6-b799-4462-824d-fc045d3a9d25'
]
};
await client.api('/admin/cloudLicensing/assignments')
.version('beta')
.post(assignment);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\CloudLicensing\Assignment;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Assignment();
$requestBody->setOdataType('#microsoft.graph.cloudLicensing.assignment');
$requestBody->setDisabledServicePlanIds(['bed136c6-b799-4462-824d-fc045d3a9d25', ]);
$additionalData = [
'allotment@odata.bind' => 'https://graph.microsoft.com/beta/admin/cloudLicensing/allotments/rkocgef3dgjhnu3gmu2mqhbdbmwcymnf6fk3k6a7zbui5e7gfpmi',
'assignedTo@odata.bind' => 'https://graph.microsoft.com/beta/users/6d645c5f-089f-40d8-b0e7-136fb5c56d5b',
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->admin()->cloudLicensing()->assignments()->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.models.cloud_licensing.assignment import Assignment
# To initialize your graph_client, see https://dotnet.territoriali.olinfo.it/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Assignment(
odata_type = "#microsoft.graph.cloudLicensing.assignment",
disabled_service_plan_ids = [
UUID("bed136c6-b799-4462-824d-fc045d3a9d25"),
],
additional_data = {
"allotment@odata_bind" : "https://graph.microsoft.com/beta/admin/cloudLicensing/allotments/rkocgef3dgjhnu3gmu2mqhbdbmwcymnf6fk3k6a7zbui5e7gfpmi",
"assigned_to@odata_bind" : "https://graph.microsoft.com/beta/users/6d645c5f-089f-40d8-b0e7-136fb5c56d5b",
}
)
result = await graph_client.admin.cloud_licensing.assignments.post(request_body)
Antwort
Das folgende Beispiel zeigt die Antwort.
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.cloudLicensing.assignment",
"id": "405ee855-dd74-f695-8d7e-be35a6788fe8",
"disabledServicePlanIds": [
"bed136c6-b799-4462-824d-fc045d3a9d25"
]
}