AWS SDK Version 3 for .NET
API Reference

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.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.SecretsManager.AmazonSecretsManagerRequest
      Amazon.SecretsManager.Model.GetRandomPasswordRequest

Namespace: Amazon.SecretsManager.Model
Assembly: AWSSDK.SecretsManager.dll
Version: 3.x.y.z

Syntax

C#
public class GetRandomPasswordRequest : AmazonSecretsManagerRequest
         IAmazonWebServiceRequest

The GetRandomPasswordRequest type exposes the following members

Constructors

NameDescription
Public Method GetRandomPasswordRequest()

Properties

NameTypeDescription
Public Property ExcludeCharacters System.String

Gets and sets the property ExcludeCharacters.

A string of the characters that you don't want in the password.

Public Property 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.

Public Property 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.

Public Property ExcludePunctuation System.Boolean

Gets and sets the property ExcludePunctuation.

Specifies whether to exclude the following punctuation characters from the password: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~. If you don't include this switch, the password can contain punctuation.

Public Property 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.

Public Property 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.

Public Property 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.

Public Property 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.

Examples

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.

To generate a random password


var client = new AmazonSecretsManagerClient();
var response = client.GetRandomPassword(new GetRandomPasswordRequest 
{
    IncludeSpace = true,
    PasswordLength = 20,
    RequireEachIncludedType = true
});

string randomPassword = response.RandomPassword;

            

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5, 4.0, 3.5