protected override void ProcessRecord() { base.ProcessRecord(); UpdateAuthenticationPolicyRequest request; try { request = new UpdateAuthenticationPolicyRequest { CompartmentId = CompartmentId, UpdateAuthenticationPolicyDetails = UpdateAuthenticationPolicyDetails, IfMatch = IfMatch }; response = client.UpdateAuthenticationPolicy(request).GetAwaiter().GetResult(); WriteOutput(response, response.AuthenticationPolicy); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
private static async Task UpdateAuthenticationPolicy(string tenantId, IdentityClient client) { var passwordPolicy = new PasswordPolicy { MinimumPasswordLength = 15, // note that this is changed from the default IsLowercaseCharactersRequired = true, IsUppercaseCharactersRequired = true, IsNumericCharactersRequired = true, IsSpecialCharactersRequired = true, IsUsernameContainmentAllowed = false }; var updateAuthenticationPolicyDetails = new UpdateAuthenticationPolicyDetails { PasswordPolicy = passwordPolicy }; var updateAuthenticationPolicyRequest = new UpdateAuthenticationPolicyRequest { UpdateAuthenticationPolicyDetails = updateAuthenticationPolicyDetails, CompartmentId = tenantId }; var response = await client.UpdateAuthenticationPolicy(updateAuthenticationPolicyRequest); logger.Info($"The new minimum password length of Authentication Policy is {response.AuthenticationPolicy.PasswordPolicy.MinimumPasswordLength}"); }