Namespace: microsoft.graph
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.
Ein neues Anwendungs-Objekt erstellen. Diese API kann auch ein agentIdentityBlueprint-Objekt erstellen, wenn die eigenschaft @odata.type auf #microsoft.graph.agentIdentityBlueprintfestgelegt ist.
Wichtig
Geben Sie keine Anwendungsclient-IDs (appId) in der API-Dokumentation oder in Codebeispielen frei.
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) |
Application.ReadWrite.All |
AgentIdentityBlueprint.Create |
| Delegiert (persönliches Microsoft-Konto) |
Application.ReadWrite.All |
Nicht verfügbar. |
| Application |
Application.ReadWrite.OwnedBy |
AgentIdentityBlueprint.Create, Application.ReadWrite.All |
Wichtig
In delegierten Szenarien mit Geschäfts-, Schul- oder Unikonten muss dem Administrator eine unterstützte Microsoft Entra Rolle oder eine benutzerdefinierte Rolle mit einer unterstützten Rollenberechtigung zugewiesen werden. Die folgenden Rollen mit den geringsten Berechtigungen werden für diesen Vorgang unterstützt.
- Ein Nicht-Administratormitglied oder Gast mit Standardbenutzerberechtigungen, es sei denn, der Mandantenadministrator hat eingeschränkten Zugriff.
- Anwendungsentwickler: Erstellen Sie Apps auch dann, wenn der Administrator den Zugriff auf Mitglieder und Gäste eingeschränkt hat. Dem Prinzipal mit dieser Rolle wird der Besitz der app zugewiesen, die er erstellt hat.
- Verzeichnisautoren: Aktualisieren der Erweiterungseigenschaften
- Hybrididentitätsadministrator : Nur grundlegende Eigenschaften aktualisieren
- Sicherheitsadministrator
- Cloudanwendungsadministrator
- Anwendungsadministrator
HTTP-Anforderung
POST /applications
Anforderungstext
Geben Sie im Anforderungstext eine JSON-Darstellung eines application-Objekts an. Der Anforderungstext muss displayName enthalten, eine erforderliche Eigenschaft. Um einen agentIdentityBlueprint zu erstellen, legen Sie auch die eigenschaft @odata.type auf fest #microsoft.graph.agentIdentityBlueprint.
Antwort
Bei erfolgreicher Ausführung gibt die Methode den Antwortcode und ein Application- oder agentIdentityBlueprint-Objekt im Antworttext zurück.201 Created
Beispiele
Beispiel 1: Erstellen einer Anwendung mit den Standardeinstellungen
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
POST https://graph.microsoft.com/beta/applications
Content-type: application/json
{
"displayName": "Display name"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Application
{
DisplayName = "Display name",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Applications.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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewApplication()
displayName := "Display name"
requestBody.SetDisplayName(&displayName)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
applications, err := graphClient.Applications().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Application application = new Application();
application.setDisplayName("Display name");
Application result = graphClient.applications().post(application);
const options = {
authProvider,
};
const client = Client.init(options);
const application = {
displayName: 'Display name'
};
await client.api('/applications')
.version('beta')
.post(application);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Application;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Application();
$requestBody->setDisplayName('Display name');
$result = $graphServiceClient->applications()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Applications
$params = @{
displayName = "Display name"
}
New-MgBetaApplication -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.application import Application
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Application(
display_name = "Display name",
)
result = await graph_client.applications.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.context": "https://graph.microsoft.com/beta/$metadata#applications/$entity",
"id": "03ef14b0-ca33-4840-8f4f-d6e91916010e",
"deletedDateTime": null,
"isFallbackPublicClient": null,
"appId": "631a96bc-a705-4eda-9f99-fdaf9f54f6a2",
"applicationTemplateId": null,
"identifierUris": [],
"createdDateTime": "2019-09-17T19:10:35.2742618Z",
"displayName": "Display name",
"isDeviceOnlyAuthSupported": null,
"groupMembershipClaims": null,
"optionalClaims": null,
"addIns": [],
"publisherDomain": "contoso.com",
"samlMetadataUrl": "https://graph.microsoft.com/2h5hjaj542de/app",
"signInAudience": "AzureADandPersonalMicrosoftAccount",
"tags": [],
"tokenEncryptionKeyId": null,
"api": {
"requestedAccessTokenVersion": 2,
"acceptMappedClaims": null,
"knownClientApplications": [],
"oauth2PermissionScopes": [],
"preAuthorizedApplications": []
},
"appRoles": [],
"publicClient": {
"redirectUris": []
},
"info": {
"termsOfServiceUrl": null,
"supportUrl": null,
"privacyStatementUrl": null,
"marketingUrl": null,
"logoUrl": null
},
"keyCredentials": [],
"parentalControlSettings": {
"countriesBlockedForMinors": [],
"legalAgeGroupRule": "Allow"
},
"passwordCredentials": [],
"requiredResourceAccess": [],
"uniqueName": null,
"web": {
"redirectUris": [],
"homePageUrl": null,
"logoutUrl": null,
"implicitGrantSettings": {
"enableIdTokenIssuance": false,
"enableAccessTokenIssuance": false
}
},
"windows" : null
}
Beispiel 2: Erstellen einer neuen Anwendung und Hinzufügen eines Kennwortgeheimnisses
Anforderung
POST https://graph.microsoft.com/beta/applications
Content-type: application/json
{
"displayName": "MyAppName",
"passwordCredentials": [
{
"displayName": "Password name"
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Application
{
DisplayName = "MyAppName",
PasswordCredentials = new List<PasswordCredential>
{
new PasswordCredential
{
DisplayName = "Password name",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Applications.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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewApplication()
displayName := "MyAppName"
requestBody.SetDisplayName(&displayName)
passwordCredential := graphmodels.NewPasswordCredential()
displayName := "Password name"
passwordCredential.SetDisplayName(&displayName)
passwordCredentials := []graphmodels.PasswordCredentialable {
passwordCredential,
}
requestBody.SetPasswordCredentials(passwordCredentials)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
applications, err := graphClient.Applications().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Application application = new Application();
application.setDisplayName("MyAppName");
LinkedList<PasswordCredential> passwordCredentials = new LinkedList<PasswordCredential>();
PasswordCredential passwordCredential = new PasswordCredential();
passwordCredential.setDisplayName("Password name");
passwordCredentials.add(passwordCredential);
application.setPasswordCredentials(passwordCredentials);
Application result = graphClient.applications().post(application);
const options = {
authProvider,
};
const client = Client.init(options);
const application = {
displayName: 'MyAppName',
passwordCredentials: [
{
displayName: 'Password name'
}
]
};
await client.api('/applications')
.version('beta')
.post(application);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Application;
use Microsoft\Graph\Beta\Generated\Models\PasswordCredential;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Application();
$requestBody->setDisplayName('MyAppName');
$passwordCredentialsPasswordCredential1 = new PasswordCredential();
$passwordCredentialsPasswordCredential1->setDisplayName('Password name');
$passwordCredentialsArray []= $passwordCredentialsPasswordCredential1;
$requestBody->setPasswordCredentials($passwordCredentialsArray);
$result = $graphServiceClient->applications()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Applications
$params = @{
displayName = "MyAppName"
passwordCredentials = @(
@{
displayName = "Password name"
}
)
}
New-MgBetaApplication -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.application import Application
from msgraph_beta.generated.models.password_credential import PasswordCredential
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Application(
display_name = "MyAppName",
password_credentials = [
PasswordCredential(
display_name = "Password name",
),
],
)
result = await graph_client.applications.post(request_body)
Antwort
Das folgende Beispiel zeigt die Antwort. Die secretText-Eigenschaft im Antwortobjekt enthält die von Microsoft Entra ID generierten sicheren Kennwörter oder Geheimnisse und ist 16 bis 64 Zeichen lang. Es gibt keine Möglichkeit, dieses Kennwort in Zukunft abzurufen.
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#applications/$entity",
"id": "83ab4737-da9d-4084-86f2-f8fbec220647",
"deletedDateTime": null,
"appId": "9519e58c-bd06-4120-a7fd-2220d4de8409",
"applicationTemplateId": null,
"disabledByMicrosoftStatus": null,
"createdDateTime": "2024-04-01T19:10:02.6626202Z",
"displayName": "MyAppName",
"description": null,
"keyCredentials": [],
"parentalControlSettings": {
"countriesBlockedForMinors": [],
"legalAgeGroupRule": "Allow"
},
"passwordCredentials": [
{
"customKeyIdentifier": null,
"displayName": "Password name",
"endDateTime": "2026-04-01T19:10:02.6576213Z",
"hint": "puE",
"keyId": "09a0c91a-1bc3-4eaf-a945-c88c041fad6c",
"secretText": "1234567890abcdefghijklmnopqrstuvwxyzabcd",
"startDateTime": "2024-04-01T19:10:02.6576213Z"
}
],
"publicClient": {
"redirectUris": []
}
}
Beispiel 3: Erstellen einer neuen mehrinstanzenfähigen Anwendung, die auf einige Mandanten beschränkt ist
Anforderung
Im folgenden Beispiel wird eine mehrinstanzenfähige Anwendung erstellt, die nur in zwei zulässigen Microsoft Entra Mandanten (und dem Mandanten, in dem die App registriert ist) verwendet werden kann.
POST https://graph.microsoft.com/beta/applications
Content-type: application/json
{
"displayName": "MyAppName",
"signInAudience": "AzureADMultipleOrgs",
"signInAudienceRestrictions": {
"@odata.type": "#microsoft.graph.allowedTenantsAudience",
"isHomeTenantAllowed": true,
"allowedTenantIds": [
"818ce016-78c2-457c-91d7-c02c2faaa5fe",
"c62670b0-53a1-4a38-b26c-4093cbaa510a"
]
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Application
{
DisplayName = "MyAppName",
SignInAudience = "AzureADMultipleOrgs",
SignInAudienceRestrictions = new AllowedTenantsAudience
{
OdataType = "#microsoft.graph.allowedTenantsAudience",
IsHomeTenantAllowed = true,
AllowedTenantIds = new List<string>
{
"818ce016-78c2-457c-91d7-c02c2faaa5fe",
"c62670b0-53a1-4a38-b26c-4093cbaa510a",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Applications.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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewApplication()
displayName := "MyAppName"
requestBody.SetDisplayName(&displayName)
signInAudience := "AzureADMultipleOrgs"
requestBody.SetSignInAudience(&signInAudience)
signInAudienceRestrictions := graphmodels.NewAllowedTenantsAudience()
isHomeTenantAllowed := true
signInAudienceRestrictions.SetIsHomeTenantAllowed(&isHomeTenantAllowed)
allowedTenantIds := []string {
"818ce016-78c2-457c-91d7-c02c2faaa5fe",
"c62670b0-53a1-4a38-b26c-4093cbaa510a",
}
signInAudienceRestrictions.SetAllowedTenantIds(allowedTenantIds)
requestBody.SetSignInAudienceRestrictions(signInAudienceRestrictions)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
applications, err := graphClient.Applications().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Application application = new Application();
application.setDisplayName("MyAppName");
application.setSignInAudience("AzureADMultipleOrgs");
AllowedTenantsAudience signInAudienceRestrictions = new AllowedTenantsAudience();
signInAudienceRestrictions.setOdataType("#microsoft.graph.allowedTenantsAudience");
signInAudienceRestrictions.setIsHomeTenantAllowed(true);
LinkedList<String> allowedTenantIds = new LinkedList<String>();
allowedTenantIds.add("818ce016-78c2-457c-91d7-c02c2faaa5fe");
allowedTenantIds.add("c62670b0-53a1-4a38-b26c-4093cbaa510a");
signInAudienceRestrictions.setAllowedTenantIds(allowedTenantIds);
application.setSignInAudienceRestrictions(signInAudienceRestrictions);
Application result = graphClient.applications().post(application);
const options = {
authProvider,
};
const client = Client.init(options);
const application = {
displayName: 'MyAppName',
signInAudience: 'AzureADMultipleOrgs',
signInAudienceRestrictions: {
'@odata.type': '#microsoft.graph.allowedTenantsAudience',
isHomeTenantAllowed: true,
allowedTenantIds: [
'818ce016-78c2-457c-91d7-c02c2faaa5fe',
'c62670b0-53a1-4a38-b26c-4093cbaa510a'
]
}
};
await client.api('/applications')
.version('beta')
.post(application);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Application;
use Microsoft\Graph\Beta\Generated\Models\AllowedTenantsAudience;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Application();
$requestBody->setDisplayName('MyAppName');
$requestBody->setSignInAudience('AzureADMultipleOrgs');
$signInAudienceRestrictions = new AllowedTenantsAudience();
$signInAudienceRestrictions->setOdataType('#microsoft.graph.allowedTenantsAudience');
$signInAudienceRestrictions->setIsHomeTenantAllowed(true);
$signInAudienceRestrictions->setAllowedTenantIds(['818ce016-78c2-457c-91d7-c02c2faaa5fe', 'c62670b0-53a1-4a38-b26c-4093cbaa510a', ]);
$requestBody->setSignInAudienceRestrictions($signInAudienceRestrictions);
$result = $graphServiceClient->applications()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Applications
$params = @{
displayName = "MyAppName"
signInAudience = "AzureADMultipleOrgs"
signInAudienceRestrictions = @{
"@odata.type" = "#microsoft.graph.allowedTenantsAudience"
isHomeTenantAllowed = $true
allowedTenantIds = @(
"818ce016-78c2-457c-91d7-c02c2faaa5fe"
"c62670b0-53a1-4a38-b26c-4093cbaa510a"
)
}
}
New-MgBetaApplication -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.application import Application
from msgraph_beta.generated.models.allowed_tenants_audience import AllowedTenantsAudience
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Application(
display_name = "MyAppName",
sign_in_audience = "AzureADMultipleOrgs",
sign_in_audience_restrictions = AllowedTenantsAudience(
odata_type = "#microsoft.graph.allowedTenantsAudience",
is_home_tenant_allowed = True,
allowed_tenant_ids = [
"818ce016-78c2-457c-91d7-c02c2faaa5fe",
"c62670b0-53a1-4a38-b26c-4093cbaa510a",
],
),
)
result = await graph_client.applications.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 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#applications/$entity",
"id": "83ab4737-da9d-4084-86f2-f8fbec220647",
"appId": "9519e58c-bd06-4120-a7fd-2220d4de8409",
"createdDateTime": "2025-11-01T19:10:02.6626202Z",
"displayName": "MyAppName",
"signInAudience": "AzureADMultipleOrgs",
"signInAudienceRestrictions": {
"@odata.type": "#microsoft.graph.allowedTenantsAudience",
"isHomeTenantAllowed": true,
"allowedTenantIds": [
"818ce016-78c2-457c-91d7-c02c2faaa5fe",
"c62670b0-53a1-4a38-b26c-4093cbaa510a"
]
}
}