TenantAppManagementPolicy aktualisieren
- Artikel
- 10 Minuten Lesedauer
Namespace: microsoft.graph
Wichtig
APIs unter der /beta Version in Microsoft Graph können geändert werden. Die Verwendung dieser APIs in Produktionsanwendungen wird nicht unterstützt. Um festzustellen, ob eine API in Version 1.0 verfügbar ist, verwenden Sie die Versionsauswahl .
Dient zum Aktualisieren der Eigenschaften eines tenantAppManagementPolicy-Objekts .
Berechtigungen
Eine der nachfolgenden Berechtigungen ist erforderlich, um diese API aufrufen zu können. Weitere Informationen, unter anderem zur Auswahl von Berechtigungen, finden Sie im Artikel zum Thema Berechtigungen.
| Berechtigungstyp | Berechtigungen (von der Berechtigung mit den wenigsten Rechten zu der mit den meisten Rechten) |
|---|---|
| Delegiert (Geschäfts-, Schul- oder Unikonto) | Policy.ReadWrite.ApplicationConfiguration |
| Delegiert (persönliches Microsoft-Konto) | Nicht unterstützt |
| Anwendung | Policy.ReadWrite.ApplicationConfiguration |
HTTP-Anforderung
PATCH /policies/defaultAppManagementPolicy
Anforderungsheader
| Name | Beschreibung |
|---|---|
| Authorization | Bearer {token}. Erforderlich. |
| Content-Type | application/json. Erforderlich. |
Anforderungstext
Geben Sie im Anforderungstext die Werte für relevante Felder aus der tenantAppManagementPolicy an, die aktualisiert werden sollen. Vorhandene Eigenschaften, die nicht im Anforderungstext enthalten sind, behalten ihre vorherigen Werte bei. Um eine optimale Leistung zu erzielen, fügen Sie keine unveränderten Werte in die Anforderungsnutzlast ein.
| Eigenschaft | Typ | Beschreibung |
|---|---|---|
| applicationRestrictions | appManagementConfiguration | Einschränkungen, die standardmäßig für alle Anwendungsobjekte im Mandanten gelten. |
| displayName | Zeichenfolge | Der Anzeigename der Standardrichtlinie. Geerbt von policyBase. |
| description | String | Die Beschreibung der Standardrichtlinie. Geerbt von policyBase. |
| isEnabled | Boolescher Wert | Gibt an, ob die Richtlinie aktiviert ist. Standardwert ist "false". |
| servicePrincipalRestrictions | appManagementConfiguration | Einschränkungen, die standardmäßig für alle Dienstprinzipalobjekte im Mandanten gelten. |
Antwort
Wenn die Methode erfolgreich verläuft, wird der Antwortcode 204 No Content zurückgegeben. Im Antworttext wird nichts zurückgegeben.
Beispiele
Anforderung
Nachfolgend sehen Sie ein Beispiel der Anforderung.
PATCH https://graph.microsoft.com/beta/policies/defaultAppManagementPolicy
Content-Type: application/json
{
"isEnabled": true,
"applicationRestrictions": {
"passwordCredentials": [
{
"restrictionType": "passwordAddition",
"maxLifetime": null,
"restrictForAppsCreatedAfterDateTime": "2021-01-01T10:37:00Z"
},
{
"restrictionType": "passwordLifetime",
"maxLifetime": "P4DT12H30M5S",
"restrictForAppsCreatedAfterDateTime": "2017-01-01T10:37:00Z"
},
{
"restrictionType": "symmetricKeyAddition",
"maxLifetime": null,
"restrictForAppsCreatedAfterDateTime": "2021-01-01T10:37:00Z"
},
{
"restrictionType": "customPasswordAddition",
"maxLifetime": null,
"restrictForAppsCreatedAfterDateTime": "2015-01-01T10:37:00Z"
},
{
"restrictionType": "symmetricKeyLifetime",
"maxLifetime": "P40D",
"restrictForAppsCreatedAfterDateTime": "2015-01-01T10:37:00Z"
}
],
"keyCredentials":[
{
"restrictionType": "asymmetricKeyLifetime",
"maxLifetime": "P30D",
"restrictForAppsCreatedAfterDateTime": "2015-01-01T10:37:00Z"
},
]
}
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var tenantAppManagementPolicy = new TenantAppManagementPolicy
{
IsEnabled = true,
ApplicationRestrictions = new AppManagementConfiguration
{
PasswordCredentials = new List<PasswordCredentialConfiguration>()
{
new PasswordCredentialConfiguration
{
RestrictionType = AppCredentialRestrictionType.PasswordAddition,
MaxLifetime = null,
RestrictForAppsCreatedAfterDateTime = DateTimeOffset.Parse("2021-01-01T10:37:00Z")
},
new PasswordCredentialConfiguration
{
RestrictionType = AppCredentialRestrictionType.PasswordLifetime,
MaxLifetime = new Duration("P4DT12H30M5S"),
RestrictForAppsCreatedAfterDateTime = DateTimeOffset.Parse("2017-01-01T10:37:00Z")
},
new PasswordCredentialConfiguration
{
RestrictionType = AppCredentialRestrictionType.SymmetricKeyAddition,
MaxLifetime = null,
RestrictForAppsCreatedAfterDateTime = DateTimeOffset.Parse("2021-01-01T10:37:00Z")
},
new PasswordCredentialConfiguration
{
RestrictionType = AppCredentialRestrictionType.CustomPasswordAddition,
MaxLifetime = null,
RestrictForAppsCreatedAfterDateTime = DateTimeOffset.Parse("2015-01-01T10:37:00Z")
},
new PasswordCredentialConfiguration
{
RestrictionType = AppCredentialRestrictionType.SymmetricKeyLifetime,
MaxLifetime = new Duration("P40D"),
RestrictForAppsCreatedAfterDateTime = DateTimeOffset.Parse("2015-01-01T10:37:00Z")
}
},
KeyCredentials = new List<KeyCredentialConfiguration>()
{
new KeyCredentialConfiguration
{
RestrictionType = AppKeyCredentialRestrictionType.AsymmetricKeyLifetime,
MaxLifetime = new Duration("P30D"),
RestrictForAppsCreatedAfterDateTime = DateTimeOffset.Parse("2015-01-01T10:37:00Z")
}
}
}
};
await graphClient.Policies.DefaultAppManagementPolicy
.Request()
.UpdateAsync(tenantAppManagementPolicy);
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var tenantAppManagementPolicy = new TenantAppManagementPolicy
{
IsEnabled = true,
ApplicationRestrictions = new AppManagementConfiguration
{
PasswordCredentials = new List<PasswordCredentialConfiguration>()
{
new PasswordCredentialConfiguration
{
RestrictionType = AppCredentialRestrictionType.PasswordAddition,
MaxLifetime = null,
RestrictForAppsCreatedAfterDateTime = DateTimeOffset.Parse("2021-01-01T10:37:00Z")
},
new PasswordCredentialConfiguration
{
RestrictionType = AppCredentialRestrictionType.PasswordLifetime,
MaxLifetime = new Duration("P4DT12H30M5S"),
RestrictForAppsCreatedAfterDateTime = DateTimeOffset.Parse("2017-01-01T10:37:00Z")
},
new PasswordCredentialConfiguration
{
RestrictionType = AppCredentialRestrictionType.SymmetricKeyAddition,
MaxLifetime = null,
RestrictForAppsCreatedAfterDateTime = DateTimeOffset.Parse("2021-01-01T10:37:00Z")
},
new PasswordCredentialConfiguration
{
RestrictionType = AppCredentialRestrictionType.CustomPasswordAddition,
MaxLifetime = null,
RestrictForAppsCreatedAfterDateTime = DateTimeOffset.Parse("2015-01-01T10:37:00Z")
},
new PasswordCredentialConfiguration
{
RestrictionType = AppCredentialRestrictionType.SymmetricKeyLifetime,
MaxLifetime = new Duration("P40D"),
RestrictForAppsCreatedAfterDateTime = DateTimeOffset.Parse("2015-01-01T10:37:00Z")
}
},
KeyCredentials = new List<KeyCredentialConfiguration>()
{
new KeyCredentialConfiguration
{
RestrictionType = AppKeyCredentialRestrictionType.AsymmetricKeyLifetime,
MaxLifetime = new Duration("P30D"),
RestrictForAppsCreatedAfterDateTime = DateTimeOffset.Parse("2015-01-01T10:37:00Z")
}
}
}
};
await graphClient.Policies.DefaultAppManagementPolicy
.Request()
.UpdateAsync(tenantAppManagementPolicy);
Wichtig
Microsoft Graph SDKs verwenden standardmäßig die Version 1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Betaversion verfügbar sind. Ausführliche Informationen zum Zugreifen auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph-SDKs mit der Beta-API.
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation.
const options = {
authProvider,
};
const client = Client.init(options);
const tenantAppManagementPolicy = {
isEnabled: true,
applicationRestrictions: {
passwordCredentials: [
{
restrictionType: 'passwordAddition',
maxLifetime: null,
restrictForAppsCreatedAfterDateTime: '2021-01-01T10:37:00Z'
},
{
restrictionType: 'passwordLifetime',
maxLifetime: 'P4DT12H30M5S',
restrictForAppsCreatedAfterDateTime: '2017-01-01T10:37:00Z'
},
{
restrictionType: 'symmetricKeyAddition',
maxLifetime: null,
restrictForAppsCreatedAfterDateTime: '2021-01-01T10:37:00Z'
},
{
restrictionType: 'customPasswordAddition',
maxLifetime: null,
restrictForAppsCreatedAfterDateTime: '2015-01-01T10:37:00Z'
},
{
restrictionType: 'symmetricKeyLifetime',
maxLifetime: 'P40D',
restrictForAppsCreatedAfterDateTime: '2015-01-01T10:37:00Z'
}
],
keyCredentials: [
{
restrictionType: 'asymmetricKeyLifetime',
maxLifetime: 'P30D',
restrictForAppsCreatedAfterDateTime: '2015-01-01T10:37:00Z'
},
]
}
};
await client.api('/policies/defaultAppManagementPolicy')
.version('beta')
.update(tenantAppManagementPolicy);
const options = {
authProvider,
};
const client = Client.init(options);
const tenantAppManagementPolicy = {
isEnabled: true,
applicationRestrictions: {
passwordCredentials: [
{
restrictionType: 'passwordAddition',
maxLifetime: null,
restrictForAppsCreatedAfterDateTime: '2021-01-01T10:37:00Z'
},
{
restrictionType: 'passwordLifetime',
maxLifetime: 'P4DT12H30M5S',
restrictForAppsCreatedAfterDateTime: '2017-01-01T10:37:00Z'
},
{
restrictionType: 'symmetricKeyAddition',
maxLifetime: null,
restrictForAppsCreatedAfterDateTime: '2021-01-01T10:37:00Z'
},
{
restrictionType: 'customPasswordAddition',
maxLifetime: null,
restrictForAppsCreatedAfterDateTime: '2015-01-01T10:37:00Z'
},
{
restrictionType: 'symmetricKeyLifetime',
maxLifetime: 'P40D',
restrictForAppsCreatedAfterDateTime: '2015-01-01T10:37:00Z'
}
],
keyCredentials: [
{
restrictionType: 'asymmetricKeyLifetime',
maxLifetime: 'P30D',
restrictForAppsCreatedAfterDateTime: '2015-01-01T10:37:00Z'
},
]
}
};
await client.api('/policies/defaultAppManagementPolicy')
.version('beta')
.update(tenantAppManagementPolicy);
Wichtig
Microsoft Graph SDKs verwenden standardmäßig die Version 1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Betaversion verfügbar sind. Ausführliche Informationen zum Zugreifen auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph-SDKs mit der Beta-API.
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation.
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/policies/defaultAppManagementPolicy"]]];
[urlRequest setHTTPMethod:@"PATCH"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphTenantAppManagementPolicy *tenantAppManagementPolicy = [[MSGraphTenantAppManagementPolicy alloc] init];
[tenantAppManagementPolicy setIsEnabled: true];
MSGraphAppManagementConfiguration *applicationRestrictions = [[MSGraphAppManagementConfiguration alloc] init];
NSMutableArray *passwordCredentialsList = [[NSMutableArray alloc] init];
MSGraphPasswordCredentialConfiguration *passwordCredentials = [[MSGraphPasswordCredentialConfiguration alloc] init];
[passwordCredentials setRestrictionType: [MSGraphAppCredentialRestrictionType passwordAddition]];
[passwordCredentials setMaxLifetime: null];
[passwordCredentials setRestrictForAppsCreatedAfterDateTime: "2021-01-01T10:37:00Z"];
[passwordCredentialsList addObject: passwordCredentials];
MSGraphPasswordCredentialConfiguration *passwordCredentials = [[MSGraphPasswordCredentialConfiguration alloc] init];
[passwordCredentials setRestrictionType: [MSGraphAppCredentialRestrictionType passwordLifetime]];
[passwordCredentials setMaxLifetime:@"P4DT12H30M5S"];
[passwordCredentials setRestrictForAppsCreatedAfterDateTime: "2017-01-01T10:37:00Z"];
[passwordCredentialsList addObject: passwordCredentials];
MSGraphPasswordCredentialConfiguration *passwordCredentials = [[MSGraphPasswordCredentialConfiguration alloc] init];
[passwordCredentials setRestrictionType: [MSGraphAppCredentialRestrictionType symmetricKeyAddition]];
[passwordCredentials setMaxLifetime: null];
[passwordCredentials setRestrictForAppsCreatedAfterDateTime: "2021-01-01T10:37:00Z"];
[passwordCredentialsList addObject: passwordCredentials];
MSGraphPasswordCredentialConfiguration *passwordCredentials = [[MSGraphPasswordCredentialConfiguration alloc] init];
[passwordCredentials setRestrictionType: [MSGraphAppCredentialRestrictionType customPasswordAddition]];
[passwordCredentials setMaxLifetime: null];
[passwordCredentials setRestrictForAppsCreatedAfterDateTime: "2015-01-01T10:37:00Z"];
[passwordCredentialsList addObject: passwordCredentials];
MSGraphPasswordCredentialConfiguration *passwordCredentials = [[MSGraphPasswordCredentialConfiguration alloc] init];
[passwordCredentials setRestrictionType: [MSGraphAppCredentialRestrictionType symmetricKeyLifetime]];
[passwordCredentials setMaxLifetime:@"P40D"];
[passwordCredentials setRestrictForAppsCreatedAfterDateTime: "2015-01-01T10:37:00Z"];
[passwordCredentialsList addObject: passwordCredentials];
[applicationRestrictions setPasswordCredentials:passwordCredentialsList];
NSMutableArray *keyCredentialsList = [[NSMutableArray alloc] init];
MSGraphKeyCredentialConfiguration *keyCredentials = [[MSGraphKeyCredentialConfiguration alloc] init];
[keyCredentials setRestrictionType: [MSGraphAppKeyCredentialRestrictionType asymmetricKeyLifetime]];
[keyCredentials setMaxLifetime:@"P30D"];
[keyCredentials setRestrictForAppsCreatedAfterDateTime: "2015-01-01T10:37:00Z"];
[keyCredentialsList addObject: keyCredentials];
[applicationRestrictions setKeyCredentials:keyCredentialsList];
[tenantAppManagementPolicy setApplicationRestrictions:applicationRestrictions];
NSError *error;
NSData *tenantAppManagementPolicyData = [tenantAppManagementPolicy getSerializedDataWithError:&error];
[urlRequest setHTTPBody:tenantAppManagementPolicyData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/policies/defaultAppManagementPolicy"]]];
[urlRequest setHTTPMethod:@"PATCH"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphTenantAppManagementPolicy *tenantAppManagementPolicy = [[MSGraphTenantAppManagementPolicy alloc] init];
[tenantAppManagementPolicy setIsEnabled: true];
MSGraphAppManagementConfiguration *applicationRestrictions = [[MSGraphAppManagementConfiguration alloc] init];
NSMutableArray *passwordCredentialsList = [[NSMutableArray alloc] init];
MSGraphPasswordCredentialConfiguration *passwordCredentials = [[MSGraphPasswordCredentialConfiguration alloc] init];
[passwordCredentials setRestrictionType: [MSGraphAppCredentialRestrictionType passwordAddition]];
[passwordCredentials setMaxLifetime: null];
[passwordCredentials setRestrictForAppsCreatedAfterDateTime: "2021-01-01T10:37:00Z"];
[passwordCredentialsList addObject: passwordCredentials];
MSGraphPasswordCredentialConfiguration *passwordCredentials = [[MSGraphPasswordCredentialConfiguration alloc] init];
[passwordCredentials setRestrictionType: [MSGraphAppCredentialRestrictionType passwordLifetime]];
[passwordCredentials setMaxLifetime:@"P4DT12H30M5S"];
[passwordCredentials setRestrictForAppsCreatedAfterDateTime: "2017-01-01T10:37:00Z"];
[passwordCredentialsList addObject: passwordCredentials];
MSGraphPasswordCredentialConfiguration *passwordCredentials = [[MSGraphPasswordCredentialConfiguration alloc] init];
[passwordCredentials setRestrictionType: [MSGraphAppCredentialRestrictionType symmetricKeyAddition]];
[passwordCredentials setMaxLifetime: null];
[passwordCredentials setRestrictForAppsCreatedAfterDateTime: "2021-01-01T10:37:00Z"];
[passwordCredentialsList addObject: passwordCredentials];
MSGraphPasswordCredentialConfiguration *passwordCredentials = [[MSGraphPasswordCredentialConfiguration alloc] init];
[passwordCredentials setRestrictionType: [MSGraphAppCredentialRestrictionType customPasswordAddition]];
[passwordCredentials setMaxLifetime: null];
[passwordCredentials setRestrictForAppsCreatedAfterDateTime: "2015-01-01T10:37:00Z"];
[passwordCredentialsList addObject: passwordCredentials];
MSGraphPasswordCredentialConfiguration *passwordCredentials = [[MSGraphPasswordCredentialConfiguration alloc] init];
[passwordCredentials setRestrictionType: [MSGraphAppCredentialRestrictionType symmetricKeyLifetime]];
[passwordCredentials setMaxLifetime:@"P40D"];
[passwordCredentials setRestrictForAppsCreatedAfterDateTime: "2015-01-01T10:37:00Z"];
[passwordCredentialsList addObject: passwordCredentials];
[applicationRestrictions setPasswordCredentials:passwordCredentialsList];
NSMutableArray *keyCredentialsList = [[NSMutableArray alloc] init];
MSGraphKeyCredentialConfiguration *keyCredentials = [[MSGraphKeyCredentialConfiguration alloc] init];
[keyCredentials setRestrictionType: [MSGraphAppKeyCredentialRestrictionType asymmetricKeyLifetime]];
[keyCredentials setMaxLifetime:@"P30D"];
[keyCredentials setRestrictForAppsCreatedAfterDateTime: "2015-01-01T10:37:00Z"];
[keyCredentialsList addObject: keyCredentials];
[applicationRestrictions setKeyCredentials:keyCredentialsList];
[tenantAppManagementPolicy setApplicationRestrictions:applicationRestrictions];
NSError *error;
NSData *tenantAppManagementPolicyData = [tenantAppManagementPolicy getSerializedDataWithError:&error];
[urlRequest setHTTPBody:tenantAppManagementPolicyData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
Wichtig
Microsoft Graph SDKs verwenden standardmäßig die Version 1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Betaversion verfügbar sind. Ausführliche Informationen zum Zugreifen auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph-SDKs mit der Beta-API.
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation.
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
TenantAppManagementPolicy tenantAppManagementPolicy = new TenantAppManagementPolicy();
tenantAppManagementPolicy.isEnabled = true;
AppManagementConfiguration applicationRestrictions = new AppManagementConfiguration();
LinkedList<PasswordCredentialConfiguration> passwordCredentialsList = new LinkedList<PasswordCredentialConfiguration>();
PasswordCredentialConfiguration passwordCredentials = new PasswordCredentialConfiguration();
passwordCredentials.restrictionType = AppCredentialRestrictionType.PASSWORD_ADDITION;
passwordCredentials.maxLifetime = DatatypeFactory.newInstance().newDuration("null");
passwordCredentials.restrictForAppsCreatedAfterDateTime = OffsetDateTimeSerializer.deserialize("2021-01-01T10:37:00Z");
passwordCredentialsList.add(passwordCredentials);
PasswordCredentialConfiguration passwordCredentials1 = new PasswordCredentialConfiguration();
passwordCredentials1.restrictionType = AppCredentialRestrictionType.PASSWORD_LIFETIME;
passwordCredentials1.maxLifetime = DatatypeFactory.newInstance().newDuration("P4DT12H30M5S");
passwordCredentials1.restrictForAppsCreatedAfterDateTime = OffsetDateTimeSerializer.deserialize("2017-01-01T10:37:00Z");
passwordCredentialsList.add(passwordCredentials1);
PasswordCredentialConfiguration passwordCredentials2 = new PasswordCredentialConfiguration();
passwordCredentials2.restrictionType = AppCredentialRestrictionType.SYMMETRIC_KEY_ADDITION;
passwordCredentials2.maxLifetime = DatatypeFactory.newInstance().newDuration("null");
passwordCredentials2.restrictForAppsCreatedAfterDateTime = OffsetDateTimeSerializer.deserialize("2021-01-01T10:37:00Z");
passwordCredentialsList.add(passwordCredentials2);
PasswordCredentialConfiguration passwordCredentials3 = new PasswordCredentialConfiguration();
passwordCredentials3.restrictionType = AppCredentialRestrictionType.CUSTOM_PASSWORD_ADDITION;
passwordCredentials3.maxLifetime = DatatypeFactory.newInstance().newDuration("null");
passwordCredentials3.restrictForAppsCreatedAfterDateTime = OffsetDateTimeSerializer.deserialize("2015-01-01T10:37:00Z");
passwordCredentialsList.add(passwordCredentials3);
PasswordCredentialConfiguration passwordCredentials4 = new PasswordCredentialConfiguration();
passwordCredentials4.restrictionType = AppCredentialRestrictionType.SYMMETRIC_KEY_LIFETIME;
passwordCredentials4.maxLifetime = DatatypeFactory.newInstance().newDuration("P40D");
passwordCredentials4.restrictForAppsCreatedAfterDateTime = OffsetDateTimeSerializer.deserialize("2015-01-01T10:37:00Z");
passwordCredentialsList.add(passwordCredentials4);
applicationRestrictions.passwordCredentials = passwordCredentialsList;
LinkedList<KeyCredentialConfiguration> keyCredentialsList = new LinkedList<KeyCredentialConfiguration>();
KeyCredentialConfiguration keyCredentials = new KeyCredentialConfiguration();
keyCredentials.restrictionType = AppKeyCredentialRestrictionType.ASYMMETRIC_KEY_LIFETIME;
keyCredentials.maxLifetime = DatatypeFactory.newInstance().newDuration("P30D");
keyCredentials.restrictForAppsCreatedAfterDateTime = OffsetDateTimeSerializer.deserialize("2015-01-01T10:37:00Z");
keyCredentialsList.add(keyCredentials);
applicationRestrictions.keyCredentials = keyCredentialsList;
tenantAppManagementPolicy.applicationRestrictions = applicationRestrictions;
graphClient.policies().defaultAppManagementPolicy()
.buildRequest()
.patch(tenantAppManagementPolicy);
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
TenantAppManagementPolicy tenantAppManagementPolicy = new TenantAppManagementPolicy();
tenantAppManagementPolicy.isEnabled = true;
AppManagementConfiguration applicationRestrictions = new AppManagementConfiguration();
LinkedList<PasswordCredentialConfiguration> passwordCredentialsList = new LinkedList<PasswordCredentialConfiguration>();
PasswordCredentialConfiguration passwordCredentials = new PasswordCredentialConfiguration();
passwordCredentials.restrictionType = AppCredentialRestrictionType.PASSWORD_ADDITION;
passwordCredentials.maxLifetime = DatatypeFactory.newInstance().newDuration("null");
passwordCredentials.restrictForAppsCreatedAfterDateTime = OffsetDateTimeSerializer.deserialize("2021-01-01T10:37:00Z");
passwordCredentialsList.add(passwordCredentials);
PasswordCredentialConfiguration passwordCredentials1 = new PasswordCredentialConfiguration();
passwordCredentials1.restrictionType = AppCredentialRestrictionType.PASSWORD_LIFETIME;
passwordCredentials1.maxLifetime = DatatypeFactory.newInstance().newDuration("P4DT12H30M5S");
passwordCredentials1.restrictForAppsCreatedAfterDateTime = OffsetDateTimeSerializer.deserialize("2017-01-01T10:37:00Z");
passwordCredentialsList.add(passwordCredentials1);
PasswordCredentialConfiguration passwordCredentials2 = new PasswordCredentialConfiguration();
passwordCredentials2.restrictionType = AppCredentialRestrictionType.SYMMETRIC_KEY_ADDITION;
passwordCredentials2.maxLifetime = DatatypeFactory.newInstance().newDuration("null");
passwordCredentials2.restrictForAppsCreatedAfterDateTime = OffsetDateTimeSerializer.deserialize("2021-01-01T10:37:00Z");
passwordCredentialsList.add(passwordCredentials2);
PasswordCredentialConfiguration passwordCredentials3 = new PasswordCredentialConfiguration();
passwordCredentials3.restrictionType = AppCredentialRestrictionType.CUSTOM_PASSWORD_ADDITION;
passwordCredentials3.maxLifetime = DatatypeFactory.newInstance().newDuration("null");
passwordCredentials3.restrictForAppsCreatedAfterDateTime = OffsetDateTimeSerializer.deserialize("2015-01-01T10:37:00Z");
passwordCredentialsList.add(passwordCredentials3);
PasswordCredentialConfiguration passwordCredentials4 = new PasswordCredentialConfiguration();
passwordCredentials4.restrictionType = AppCredentialRestrictionType.SYMMETRIC_KEY_LIFETIME;
passwordCredentials4.maxLifetime = DatatypeFactory.newInstance().newDuration("P40D");
passwordCredentials4.restrictForAppsCreatedAfterDateTime = OffsetDateTimeSerializer.deserialize("2015-01-01T10:37:00Z");
passwordCredentialsList.add(passwordCredentials4);
applicationRestrictions.passwordCredentials = passwordCredentialsList;
LinkedList<KeyCredentialConfiguration> keyCredentialsList = new LinkedList<KeyCredentialConfiguration>();
KeyCredentialConfiguration keyCredentials = new KeyCredentialConfiguration();
keyCredentials.restrictionType = AppKeyCredentialRestrictionType.ASYMMETRIC_KEY_LIFETIME;
keyCredentials.maxLifetime = DatatypeFactory.newInstance().newDuration("P30D");
keyCredentials.restrictForAppsCreatedAfterDateTime = OffsetDateTimeSerializer.deserialize("2015-01-01T10:37:00Z");
keyCredentialsList.add(keyCredentials);
applicationRestrictions.keyCredentials = keyCredentialsList;
tenantAppManagementPolicy.applicationRestrictions = applicationRestrictions;
graphClient.policies().defaultAppManagementPolicy()
.buildRequest()
.patch(tenantAppManagementPolicy);
Wichtig
Microsoft Graph SDKs verwenden standardmäßig die Version 1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Betaversion verfügbar sind. Ausführliche Informationen zum Zugreifen auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph-SDKs mit der Beta-API.
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation.
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewTenantAppManagementPolicy()
isEnabled := true
requestBody.SetIsEnabled(&isEnabled)
applicationRestrictions := msgraphsdk.NewAppManagementConfiguration()
requestBody.SetApplicationRestrictions(applicationRestrictions)
applicationRestrictions.SetPasswordCredentials( []PasswordCredentialConfiguration {
msgraphsdk.NewPasswordCredentialConfiguration(),
restrictionType := "passwordAddition"
SetRestrictionType(&restrictionType)
SetMaxLifetime(nil)
restrictForAppsCreatedAfterDateTime, err := time.Parse(time.RFC3339, "2021-01-01T10:37:00Z")
SetRestrictForAppsCreatedAfterDateTime(&restrictForAppsCreatedAfterDateTime)
msgraphsdk.NewPasswordCredentialConfiguration(),
restrictionType := "passwordLifetime"
SetRestrictionType(&restrictionType)
maxLifetime := "P4DT12H30M5S"
SetMaxLifetime(&maxLifetime)
restrictForAppsCreatedAfterDateTime, err := time.Parse(time.RFC3339, "2017-01-01T10:37:00Z")
SetRestrictForAppsCreatedAfterDateTime(&restrictForAppsCreatedAfterDateTime)
msgraphsdk.NewPasswordCredentialConfiguration(),
restrictionType := "symmetricKeyAddition"
SetRestrictionType(&restrictionType)
SetMaxLifetime(nil)
restrictForAppsCreatedAfterDateTime, err := time.Parse(time.RFC3339, "2021-01-01T10:37:00Z")
SetRestrictForAppsCreatedAfterDateTime(&restrictForAppsCreatedAfterDateTime)
msgraphsdk.NewPasswordCredentialConfiguration(),
restrictionType := "customPasswordAddition"
SetRestrictionType(&restrictionType)
SetMaxLifetime(nil)
restrictForAppsCreatedAfterDateTime, err := time.Parse(time.RFC3339, "2015-01-01T10:37:00Z")
SetRestrictForAppsCreatedAfterDateTime(&restrictForAppsCreatedAfterDateTime)
msgraphsdk.NewPasswordCredentialConfiguration(),
restrictionType := "symmetricKeyLifetime"
SetRestrictionType(&restrictionType)
maxLifetime := "P40D"
SetMaxLifetime(&maxLifetime)
restrictForAppsCreatedAfterDateTime, err := time.Parse(time.RFC3339, "2015-01-01T10:37:00Z")
SetRestrictForAppsCreatedAfterDateTime(&restrictForAppsCreatedAfterDateTime)
}
applicationRestrictions.SetKeyCredentials( []KeyCredentialConfiguration {
msgraphsdk.NewKeyCredentialConfiguration(),
restrictionType := "asymmetricKeyLifetime"
SetRestrictionType(&restrictionType)
maxLifetime := "P30D"
SetMaxLifetime(&maxLifetime)
restrictForAppsCreatedAfterDateTime, err := time.Parse(time.RFC3339, "2015-01-01T10:37:00Z")
SetRestrictForAppsCreatedAfterDateTime(&restrictForAppsCreatedAfterDateTime)
}
graphClient.Policies().DefaultAppManagementPolicy().Patch(requestBody)
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewTenantAppManagementPolicy()
isEnabled := true
requestBody.SetIsEnabled(&isEnabled)
applicationRestrictions := msgraphsdk.NewAppManagementConfiguration()
requestBody.SetApplicationRestrictions(applicationRestrictions)
applicationRestrictions.SetPasswordCredentials( []PasswordCredentialConfiguration {
msgraphsdk.NewPasswordCredentialConfiguration(),
restrictionType := "passwordAddition"
SetRestrictionType(&restrictionType)
SetMaxLifetime(nil)
restrictForAppsCreatedAfterDateTime, err := time.Parse(time.RFC3339, "2021-01-01T10:37:00Z")
SetRestrictForAppsCreatedAfterDateTime(&restrictForAppsCreatedAfterDateTime)
msgraphsdk.NewPasswordCredentialConfiguration(),
restrictionType := "passwordLifetime"
SetRestrictionType(&restrictionType)
maxLifetime := "P4DT12H30M5S"
SetMaxLifetime(&maxLifetime)
restrictForAppsCreatedAfterDateTime, err := time.Parse(time.RFC3339, "2017-01-01T10:37:00Z")
SetRestrictForAppsCreatedAfterDateTime(&restrictForAppsCreatedAfterDateTime)
msgraphsdk.NewPasswordCredentialConfiguration(),
restrictionType := "symmetricKeyAddition"
SetRestrictionType(&restrictionType)
SetMaxLifetime(nil)
restrictForAppsCreatedAfterDateTime, err := time.Parse(time.RFC3339, "2021-01-01T10:37:00Z")
SetRestrictForAppsCreatedAfterDateTime(&restrictForAppsCreatedAfterDateTime)
msgraphsdk.NewPasswordCredentialConfiguration(),
restrictionType := "customPasswordAddition"
SetRestrictionType(&restrictionType)
SetMaxLifetime(nil)
restrictForAppsCreatedAfterDateTime, err := time.Parse(time.RFC3339, "2015-01-01T10:37:00Z")
SetRestrictForAppsCreatedAfterDateTime(&restrictForAppsCreatedAfterDateTime)
msgraphsdk.NewPasswordCredentialConfiguration(),
restrictionType := "symmetricKeyLifetime"
SetRestrictionType(&restrictionType)
maxLifetime := "P40D"
SetMaxLifetime(&maxLifetime)
restrictForAppsCreatedAfterDateTime, err := time.Parse(time.RFC3339, "2015-01-01T10:37:00Z")
SetRestrictForAppsCreatedAfterDateTime(&restrictForAppsCreatedAfterDateTime)
}
applicationRestrictions.SetKeyCredentials( []KeyCredentialConfiguration {
msgraphsdk.NewKeyCredentialConfiguration(),
restrictionType := "asymmetricKeyLifetime"
SetRestrictionType(&restrictionType)
maxLifetime := "P30D"
SetMaxLifetime(&maxLifetime)
restrictForAppsCreatedAfterDateTime, err := time.Parse(time.RFC3339, "2015-01-01T10:37:00Z")
SetRestrictForAppsCreatedAfterDateTime(&restrictForAppsCreatedAfterDateTime)
}
graphClient.Policies().DefaultAppManagementPolicy().Patch(requestBody)
Wichtig
Microsoft Graph SDKs verwenden standardmäßig die Version 1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Betaversion verfügbar sind. Ausführliche Informationen zum Zugreifen auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph-SDKs mit der Beta-API.
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation.
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
IsEnabled = $true
ApplicationRestrictions = @{
PasswordCredentials = @(
@{
RestrictionType = "passwordAddition"
MaxLifetime = $null
RestrictForAppsCreatedAfterDateTime = [System.DateTime]::Parse("2021-01-01T10:37:00Z")
}
@{
RestrictionType = "passwordLifetime"
MaxLifetime = "P4DT12H30M5S"
RestrictForAppsCreatedAfterDateTime = [System.DateTime]::Parse("2017-01-01T10:37:00Z")
}
@{
RestrictionType = "symmetricKeyAddition"
MaxLifetime = $null
RestrictForAppsCreatedAfterDateTime = [System.DateTime]::Parse("2021-01-01T10:37:00Z")
}
@{
RestrictionType = "customPasswordAddition"
MaxLifetime = $null
RestrictForAppsCreatedAfterDateTime = [System.DateTime]::Parse("2015-01-01T10:37:00Z")
}
@{
RestrictionType = "symmetricKeyLifetime"
MaxLifetime = "P40D"
RestrictForAppsCreatedAfterDateTime = [System.DateTime]::Parse("2015-01-01T10:37:00Z")
}
)
KeyCredentials = @(
@{
RestrictionType = "asymmetricKeyLifetime"
MaxLifetime = "P30D"
RestrictForAppsCreatedAfterDateTime = [System.DateTime]::Parse("2015-01-01T10:37:00Z")
}
)
}
}
Update-MgPolicyDefaultAppManagementPolicy -BodyParameter $params
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
IsEnabled = $true
ApplicationRestrictions = @{
PasswordCredentials = @(
@{
RestrictionType = "passwordAddition"
MaxLifetime = $null
RestrictForAppsCreatedAfterDateTime = [System.DateTime]::Parse("2021-01-01T10:37:00Z")
}
@{
RestrictionType = "passwordLifetime"
MaxLifetime = "P4DT12H30M5S"
RestrictForAppsCreatedAfterDateTime = [System.DateTime]::Parse("2017-01-01T10:37:00Z")
}
@{
RestrictionType = "symmetricKeyAddition"
MaxLifetime = $null
RestrictForAppsCreatedAfterDateTime = [System.DateTime]::Parse("2021-01-01T10:37:00Z")
}
@{
RestrictionType = "customPasswordAddition"
MaxLifetime = $null
RestrictForAppsCreatedAfterDateTime = [System.DateTime]::Parse("2015-01-01T10:37:00Z")
}
@{
RestrictionType = "symmetricKeyLifetime"
MaxLifetime = "P40D"
RestrictForAppsCreatedAfterDateTime = [System.DateTime]::Parse("2015-01-01T10:37:00Z")
}
)
KeyCredentials = @(
@{
RestrictionType = "asymmetricKeyLifetime"
MaxLifetime = "P30D"
RestrictForAppsCreatedAfterDateTime = [System.DateTime]::Parse("2015-01-01T10:37:00Z")
}
)
}
}
Update-MgPolicyDefaultAppManagementPolicy -BodyParameter $params
Wichtig
Microsoft Graph SDKs verwenden standardmäßig die Version 1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Betaversion verfügbar sind. Ausführliche Informationen zum Zugreifen auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph-SDKs mit der Beta-API.
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation.
Antwort
Nachfolgend sehen Sie ein Beispiel der Antwort.
HTTP/1.1 204 No Content
Feedback
Feedback senden und anzeigen für