Namespace: microsoft.graph.security
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 ein neues Zonenobjekt . Sie können bis zu 1.000 Zonen pro Mandant erstellen.
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) |
Zone.ReadWrite.All |
Nicht verfügbar. |
| Delegiert (persönliches Microsoft-Konto) |
Nicht unterstützt |
Nicht unterstützt |
| Application |
Zone.ReadWrite.All |
Nicht verfügbar. |
Wichtig
In delegierten Szenarien mit Geschäfts-, Schul- oder Unikonten muss dem angemeldeten Benutzer 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.
HTTP-Anforderung
POST /security/zones
Anforderungstext
Geben Sie im Anforderungstext eine JSON-Darstellung des Zonenobjekts an.
Sie können die folgenden Eigenschaften angeben, wenn Sie eine Zone erstellen.
| Eigenschaft |
Typ |
Beschreibung |
| description |
Zeichenfolge |
Beschreibung der Zone. Optional. |
| displayName |
Zeichenfolge |
Lesbarer Name der Zone. Erforderlich. |
| Umgebungen |
microsoft.graph.security.environment-Sammlung |
Sammlung von Umgebungen, die an die Zone angefügt werden sollen. Optional. |
Antwort
Bei erfolgreicher Ausführung gibt die Methode einen 201 Created Antwortcode und ein microsoft.graph.security.zone-Objekt im Antworttext zurück.
Beispiele
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
POST https://graph.microsoft.com/beta/security/zones
Content-Type: application/json
{
"displayName": "Production Zone",
"description": "Zone for production environments",
"environments": [
{
"kind": "awsAccount",
"id": "181994123251"
},
{
"kind": "awsAccount",
"id": "326438728454"
},
{
"kind": "azureSubscription",
"id": "/subscriptions/02687862-a843-4846-81f0-efe9ef244daa"
},
{
"kind": "gcpProject",
"id": "69483221284"
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.Security;
var requestBody = new Zone
{
DisplayName = "Production Zone",
Description = "Zone for production environments",
Environments = new List<EnvironmentObject>
{
new EnvironmentObject
{
Kind = EnvironmentKind.AwsAccount,
Id = "181994123251",
},
new EnvironmentObject
{
Kind = EnvironmentKind.AwsAccount,
Id = "326438728454",
},
new EnvironmentObject
{
Kind = EnvironmentKind.AzureSubscription,
Id = "/subscriptions/02687862-a843-4846-81f0-efe9ef244daa",
},
new EnvironmentObject
{
Kind = EnvironmentKind.GcpProject,
Id = "69483221284",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Security.Zones.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"
graphmodelssecurity "github.com/microsoftgraph/msgraph-beta-sdk-go/models/security"
//other-imports
)
requestBody := graphmodelssecurity.NewZone()
displayName := "Production Zone"
requestBody.SetDisplayName(&displayName)
description := "Zone for production environments"
requestBody.SetDescription(&description)
environment := graphmodelssecurity.NewEnvironment()
kind := graphmodels.AWSACCOUNT_ENVIRONMENTKIND
environment.SetKind(&kind)
id := "181994123251"
environment.SetId(&id)
environment1 := graphmodelssecurity.NewEnvironment()
kind := graphmodels.AWSACCOUNT_ENVIRONMENTKIND
environment1.SetKind(&kind)
id := "326438728454"
environment1.SetId(&id)
environment2 := graphmodelssecurity.NewEnvironment()
kind := graphmodels.AZURESUBSCRIPTION_ENVIRONMENTKIND
environment2.SetKind(&kind)
id := "/subscriptions/02687862-a843-4846-81f0-efe9ef244daa"
environment2.SetId(&id)
environment3 := graphmodelssecurity.NewEnvironment()
kind := graphmodels.GCPPROJECT_ENVIRONMENTKIND
environment3.SetKind(&kind)
id := "69483221284"
environment3.SetId(&id)
environments := []graphmodelssecurity.Environmentable {
environment,
environment1,
environment2,
environment3,
}
requestBody.SetEnvironments(environments)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
zones, err := graphClient.Security().Zones().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.security.Zone zone = new com.microsoft.graph.beta.models.security.Zone();
zone.setDisplayName("Production Zone");
zone.setDescription("Zone for production environments");
LinkedList<com.microsoft.graph.beta.models.security.Environment> environments = new LinkedList<com.microsoft.graph.beta.models.security.Environment>();
com.microsoft.graph.beta.models.security.Environment environment = new com.microsoft.graph.beta.models.security.Environment();
environment.setKind(com.microsoft.graph.beta.models.security.EnvironmentKind.AwsAccount);
environment.setId("181994123251");
environments.add(environment);
com.microsoft.graph.beta.models.security.Environment environment1 = new com.microsoft.graph.beta.models.security.Environment();
environment1.setKind(com.microsoft.graph.beta.models.security.EnvironmentKind.AwsAccount);
environment1.setId("326438728454");
environments.add(environment1);
com.microsoft.graph.beta.models.security.Environment environment2 = new com.microsoft.graph.beta.models.security.Environment();
environment2.setKind(com.microsoft.graph.beta.models.security.EnvironmentKind.AzureSubscription);
environment2.setId("/subscriptions/02687862-a843-4846-81f0-efe9ef244daa");
environments.add(environment2);
com.microsoft.graph.beta.models.security.Environment environment3 = new com.microsoft.graph.beta.models.security.Environment();
environment3.setKind(com.microsoft.graph.beta.models.security.EnvironmentKind.GcpProject);
environment3.setId("69483221284");
environments.add(environment3);
zone.setEnvironments(environments);
com.microsoft.graph.models.security.Zone result = graphClient.security().zones().post(zone);
const options = {
authProvider,
};
const client = Client.init(options);
const zone = {
displayName: 'Production Zone',
description: 'Zone for production environments',
environments: [
{
kind: 'awsAccount',
id: '181994123251'
},
{
kind: 'awsAccount',
id: '326438728454'
},
{
kind: 'azureSubscription',
id: '/subscriptions/02687862-a843-4846-81f0-efe9ef244daa'
},
{
kind: 'gcpProject',
id: '69483221284'
}
]
};
await client.api('/security/zones')
.version('beta')
.post(zone);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Security\Zone;
use Microsoft\Graph\Beta\Generated\Models\Security\Environment;
use Microsoft\Graph\Beta\Generated\Models\Security\EnvironmentKind;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Zone();
$requestBody->setDisplayName('Production Zone');
$requestBody->setDescription('Zone for production environments');
$environmentsEnvironment1 = new Environment();
$environmentsEnvironment1->setKind(new EnvironmentKind('awsAccount'));
$environmentsEnvironment1->setId('181994123251');
$environmentsArray []= $environmentsEnvironment1;
$environmentsEnvironment2 = new Environment();
$environmentsEnvironment2->setKind(new EnvironmentKind('awsAccount'));
$environmentsEnvironment2->setId('326438728454');
$environmentsArray []= $environmentsEnvironment2;
$environmentsEnvironment3 = new Environment();
$environmentsEnvironment3->setKind(new EnvironmentKind('azureSubscription'));
$environmentsEnvironment3->setId('/subscriptions/02687862-a843-4846-81f0-efe9ef244daa');
$environmentsArray []= $environmentsEnvironment3;
$environmentsEnvironment4 = new Environment();
$environmentsEnvironment4->setKind(new EnvironmentKind('gcpProject'));
$environmentsEnvironment4->setId('69483221284');
$environmentsArray []= $environmentsEnvironment4;
$requestBody->setEnvironments($environmentsArray);
$result = $graphServiceClient->security()->zones()->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.security.zone import Zone
from msgraph_beta.generated.models.security.environment import Environment
from msgraph_beta.generated.models.environment_kind import EnvironmentKind
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Zone(
display_name = "Production Zone",
description = "Zone for production environments",
environments = [
Environment(
kind = EnvironmentKind.AwsAccount,
id = "181994123251",
),
Environment(
kind = EnvironmentKind.AwsAccount,
id = "326438728454",
),
Environment(
kind = EnvironmentKind.AzureSubscription,
id = "/subscriptions/02687862-a843-4846-81f0-efe9ef244daa",
),
Environment(
kind = EnvironmentKind.GcpProject,
id = "69483221284",
),
],
)
result = await graph_client.security.zones.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/security/$metadata#zones/$entity",
"@odata.type": "#microsoft.graph.security.zone",
"id": "05cfec937c214892a14448562ef4bf4a",
"displayName": "Production Zone",
"description": "Zone for production environments",
"created": {
"by": "Yarin",
"dateTime": "2023-10-01T12:00:00Z"
},
"modified": {
"by": "Yarin",
"dateTime": "2023-10-01T12:00:00Z"
},
"environments": [
{
"kind": "awsAccount",
"id": "181994123251"
},
{
"kind": "awsAccount",
"id": "326438728454"
},
{
"kind": "azureSubscription",
"id": "/subscriptions/02687862-a843-4846-81f0-efe9ef244daa"
},
{
"kind": "gcpProject",
"id": "69483221284"
}
],
"aggregations": [
{
"kind": "azureSubscription",
"count": 1
},
{
"kind": "awsAccount",
"count": 2
},
{
"kind": "gcpProject",
"count": 1
}
]
}