AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Container for the parameters to the GetRandomPassword operation.
Generates a random password. We recommend that you specify the maximum length and
include every character type that the system you are generating a password for can
support. By default, Secrets Manager uses uppercase and lowercase letters, numbers,
and the following characters in passwords: !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~
Secrets Manager generates a CloudTrail log entry when you call this action.
Required permissions: secretsmanager:GetRandomPassword
. For more information,
see
IAM policy actions for Secrets Manager and Authentication
and access control in Secrets Manager.
Namespace: Amazon.SecretsManager.Model
Assembly: AWSSDK.SecretsManager.dll
Version: 3.x.y.z
public class GetRandomPasswordRequest : AmazonSecretsManagerRequest IAmazonWebServiceRequest
The GetRandomPasswordRequest type exposes the following members
Name | Description | |
---|---|---|
![]() |
GetRandomPasswordRequest() |
Name | Type | Description | |
---|---|---|---|
![]() |
ExcludeCharacters | System.String |
Gets and sets the property ExcludeCharacters. A string of the characters that you don't want in the password. |
![]() |
ExcludeLowercase | System.Boolean |
Gets and sets the property ExcludeLowercase. Specifies whether to exclude lowercase letters from the password. If you don't include this switch, the password can contain lowercase letters. |
![]() |
ExcludeNumbers | System.Boolean |
Gets and sets the property ExcludeNumbers. Specifies whether to exclude numbers from the password. If you don't include this switch, the password can contain numbers. |
![]() |
ExcludePunctuation | System.Boolean |
Gets and sets the property ExcludePunctuation.
Specifies whether to exclude the following punctuation characters from the password:
|
![]() |
ExcludeUppercase | System.Boolean |
Gets and sets the property ExcludeUppercase. Specifies whether to exclude uppercase letters from the password. If you don't include this switch, the password can contain uppercase letters. |
![]() |
IncludeSpace | System.Boolean |
Gets and sets the property IncludeSpace. Specifies whether to include the space character. If you include this switch, the password can contain space characters. |
![]() |
PasswordLength | System.Int64 |
Gets and sets the property PasswordLength. The length of the password. If you don't include this parameter, the default length is 32 characters. |
![]() |
RequireEachIncludedType | System.Boolean |
Gets and sets the property RequireEachIncludedType. Specifies whether to include at least one upper and lowercase letter, one number, and one punctuation. If you don't include this switch, the password contains at least one of every character type. |
The following example shows how to request a randomly generated password. This example includes the optional flags to require spaces and at least one character of each included type. It specifies a length of 20 characters.
var client = new AmazonSecretsManagerClient(); var response = client.GetRandomPassword(new GetRandomPasswordRequest { IncludeSpace = true, PasswordLength = 20, RequireEachIncludedType = true }); string randomPassword = response.RandomPassword;
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5 and newer, 3.5