# New-RASCertificate.md

## NAME

New-RASCertificate

## SYNOPSIS

Creates a Certificate by Importing a Certificate/Pfx file, generating a self-signed certificate or generating a certificate request.

## SYNTAX

**New-RASCertificate** \[[Name](#name-string)] *(string)* \[\[-[SiteId](#siteid-string)] *(uint)*] -[CommonName](#commonname-string) *(string)* -[Email](#email-string) *(string)* -[RequestFile](#requestfile-string) *(string)* \[[AlternateNames](#alternatenames-string) *(string)*] \[[City](#city-string) *(string)*] \[[CountryCode](#countrycode-string) *(string)*] \[[Description](#description-string) *(string)*] \[[Enabled](#enabled-string) *(bool)*] \[[FullStateOrProvince](#fullstateorprovince-string) *(string)*] \[-[KeySize](#KeySize) {KeySize1024 | KeySize2048 | KeySize4096 | KeySize3072 | KeySize521 | KeySizeUnknown}] \[[Organisation](#organisation-string) *(string)*] \[[OrganisationUnit](#organisationunit-string) *(string)*] \[-[Usage](#Usage) {None | Gateway | HALB}] \[*(*[*CommonParameters*](#CommonParameters)*)*]

**New-RASCertificate** \[[Name](#name-string)] *(string)* \[\[-[SiteId](#siteid-string)] *(uint)*] -[CommonName](#commonname-string) *(string)* -[Email](#email-string) *(string)* \[[AlternateNames](#alternatenames-string) *(string)*] \[[City](#city-string) *(string)*] \[[CountryCode](#countrycode-string) *(string)*] \[[Description](#description-string) *(string)*] \[[Enabled](#enabled-string) *(bool)*] \[[ExpireInMonths](#expireinmonths-string) *(uint)*] \[[FullStateOrProvince](#fullstateorprovince-string) *(string)*] \[-[KeySize](#KeySize) {KeySize1024 | KeySize2048 | KeySize4096 | KeySize3072 | KeySize521 | KeySizeUnknown}] \[[Organisation](#organisation-string) *(string)*] \[[OrganisationUnit](#organisationunit-string) *(string)*] \[-[Usage](#Usage) {None | Gateway | HALB}] \[*(*[*CommonParameters*](#CommonParameters)*)*]

**New-RASCertificate** \[[Name](#name-string)] *(string)* \[\[-[SiteId](#siteid-string)] *(uint)*] -[CertificateFile](#certificatefile-string) *(string)* -[PrivateKeyFile](#privatekeyfile-string) *(string)* \[[Description](#description-string) *(string)*] \[[Enabled](#enabled-string) *(bool)*] \[-[Usage](#Usage) {None | Gateway | HALB}] \[*(*[*CommonParameters*](#CommonParameters)*)*]

**New-RASCertificate** \[[Name](#name-string)] *(string)* \[\[-[SiteId](#siteid-string)] *(uint)*] -[PfxFile](#pfxfile-string) *(string)* \[[Description](#description-string) *(string)*] \[[Enabled](#enabled-string) *(bool)*] \[[PfxPassword](#pfxpassword-string) *(SecureString)*] \[-[Usage](#Usage) {None | Gateway | HALB}] \[*(*[*CommonParameters*](#CommonParameters)*)*]

**New-RASCertificate** \[[Name](#name-string)] *(string)* \[\[-[SiteId](#siteid-string)] *(uint)*] -[CommonName](#commonname-string) *(string)* -[Email](#email-string) *(string)* -[LetsEncrypt](#letsencrypt-string) *(SwitchParameter)* \[[AlternateNames](#alternatenames-string) *(string)*] \[[City](#city-string) *(string)*] \[[CountryCode](#countrycode-string) *(string)*] \[[Description](#description-string) *(string)*] \[[Enabled](#enabled-string) *(bool)*] \[[FullStateOrProvince](#fullstateorprovince-string) *(string)*] \[-[KeySize](#KeySize) {KeySize1024 | KeySize2048 | KeySize4096 | KeySize3072 | KeySize521 | KeySizeUnknown}] \[[Organisation](#organisation-string) *(string)*] \[[OrganisationUnit](#organisationunit-string) *(string)*] \[-[Usage](#Usage) {None | Gateway | HALB}] \[*(*[*CommonParameters*](#CommonParameters)*)*]

## DESCRIPTION

By default, one is guided to create a Self-Signed Certificate.

A certificate is imported by either specifying a CertificateFile and PrivateKeyFile, or specifying a PfxFile with an optional PfxPassword.

A certificate request can be created by specifying a RequestFile path to output the request to.

## PARAMETERS

## Name (string)

The name of the target Certificate.

```
        Required?                    true

        Position?                    0

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## SiteId (uint)

Site ID in which to add the Certificate.

```
        Required?                    false

        Position?                    1

        Default value                0

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## Description (string)

A user-defined Certificate description.

```
        Required?                    false

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## PfxFile (string)

Certificate file name in pfx format.

```
        Required?                    true

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## PfxPassword (SecureString)

The password of the pfx file specified in the PfxFile parameter.

```
        Required?                    false

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## PrivateKeyFile (string)

Private key file name.

```
        Required?                    true

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## CertificateFile (string)

Certificate file name.

```
        Required?                    true

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## Usage ([CertificateUsages](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/types/certificateusages))

A set of usages to assign. To form a set of usages 'OR' individual usage enum IDs.

Possible values: None, Gateway, HALB

```
        Required?                    false

        Position?                    named

        Default value                Gateway, HALB

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## Enabled (bool)

Whether to enable or disable the certificate being created.

```
        Required?                    false

        Position?                    named

        Default value                True

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## KeySize

([CertificateKeySize](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/types/certificatekeysize)) The Key Size for the certificate to be generated.

Possible values: KeySize1024, KeySize2048, KeySize4096, KeySize3072, KeySize521, KeySizeUnknown

```
        Required?                    false

        Position?                    named

        Default value                KeySize2048

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## CountryCode (string)

The Country Code for the certificate to be generated.

By default, the country code from the PowerShell region information is used.

```
        Required?                    false

        Position?                    named

        Default value                US

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## ExpireInMonths (uint)

Specifies the length of validity of the certificate being generated.

```
        Required?                    false

        Position?                    named

        Default value                12

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## FullStateOrProvince (string)

The Full State or Province for the certificate to be generated.

```
        Required?                    false

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## City (string)

The City for the certificate to be generated.

```
        Required?                    false

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## Organisation (string)

The Organisation for the certificate to be generated.

```
        Required?                    false

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## OrganisationUnit (string)

The Organisation Unit for the certificate to be generated.

```
        Required?                    false

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## Email (string)

The Email for the certificate to be generated.

```
        Required?                    true

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## CommonName (string)

The Common Name for the certificate to be generated.

```
        Required?                    true

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## AlternateNames (string)

The Alternate Names for the certificate to be generated.

eg. IP:1.2.3.4,DNS:example.com

```
        Required?                    false

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## RequestFile (string)

Request file name to output Request Certificate to.

```
        Required?                    true

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## LetsEncrypt (SwitchParameter)

Let's Encrypt SwitchParameter

```
        Required?                    true

        Position?                    named

        Default value                False

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

(CommonParameters)

```
        This cmdlet supports the common parameters: Verbose, Debug,

        ErrorAction, ErrorVariable, WarningAction, WarningVariable,

        OutBuffer, PipelineVariable, and OutVariable. For more information, see 

        about_CommonParameters documentation. 
```

## INPUTS

-none-

## OUTPUTS

[Certificate](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/types/certificate)

## EXAMPLES

\*\*---------- EXAMPLE 1 ----------

New-RASCertificate -Name "ImportedCert" -SiteId 1 -Description "Certificate" -Usage Gateway -Enabled $true -PrivateKeyFile "C:\key.pem" -CertificateFile "C:\cert.pem"

Imports a certificate from the files key.pem and cert.pem to a certificate object with Name "ImportedCert" on Site 1.\
\*\*---------- EXAMPLE 2 ----------

New-RASCertificate -Name "ImportedPfx" -SiteId 1 -Description "Certificate" -Usage Gateway -Enabled $true -PfxFile "C:\cert.pfx" -PfxPassword $pfxPassword

Imports a certificate from a pfx file cert.pfx to a certificate object with Name "ImportedPfx" on Site 1.\
\*\*---------- EXAMPLE 3 ----------

New-RASCertificate -Name "SelfSignedCert" -SiteId 1 -Description "Certificate" -Usage Gateway -Enabled $true -Email "<test@parallels.com>" -CommonName "TestCert" -AlternateNames "DNS:\*.example.com,IP:1.2.3.4,IP:::1"

Generates a self-signed certificate with Name "SelfSignedCert" on Site 1.\
\*\*---------- EXAMPLE 4 ----------

New-RASCertificate -Name "CertRequest" -SiteId 1 -Description "Certificate" -Usage Gateway -Enabled $true -Email "<test@parallels.com>" -CommonName "TestCert" -RequestFile "C:\req.crt" -AlternateNames "DNS:example.com,IP:1.2.3.4,IP:::1"

Generates a certificate request with Name "CertRequest" on Site 1, and saves the request to req.crt

## RELATED LINKS

* [Get-RASCertificate](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/commands/get-rascertificate)
* [Remove-RASCertificate](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/commands/remove-rascertificate)
* [Set-RASCertificate](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/commands/set-rascertificate)
* [Invoke-RASExportCertificate](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/commands/invoke-rasexportcertificate)
* [Invoke-RASCertificateCmd](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/commands/invoke-rascertificatecmd)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/commands/new-rascertificate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
