> For the complete documentation index, see [llms.txt](https://docs.parallels.com/landing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.parallels.com/landing/ras-powershell-api-guide/rasadmin/cmdlets/new-rascertificate.md).

# New-RASCertificate

## SYNOPSIS

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

## SYNTAX

```powershell
New-RASCertificate [-Name] <string> [[-SiteId] <uint>] -CommonName <string> -Email <string>
 -RequestFile <string> [-AlternateNames <string>] [-City <string>] [-CountryCode <string>]
 [-Description <string>] [-Enabled <bool>] [-FullStateOrProvince <string>]
 [-KeySize {KeySize1024 | KeySize2048 | KeySize4096 | KeySize3072 | KeySize521 | KeySizeUnknown}]
 [-Organisation <string>] [-OrganisationUnit <string>]
 [-Usage {None | Gateway | HALB | CBAPIServer | CBAPIDataEncryption | CostInsights}]
 [<CommonParameters>]
```

```powershell
New-RASCertificate [-Name] <string> [[-SiteId] <uint>] -CommonName <string> -Email <string>
 [-AlternateNames <string>] [-City <string>] [-CountryCode <string>] [-Description <string>]
 [-Enabled <bool>] [-ExpireInMonths <uint>] [-FullStateOrProvince <string>]
 [-KeySize {KeySize1024 | KeySize2048 | KeySize4096 | KeySize3072 | KeySize521 | KeySizeUnknown}]
 [-Organisation <string>] [-OrganisationUnit <string>]
 [-Usage {None | Gateway | HALB | CBAPIServer | CBAPIDataEncryption | CostInsights}]
 [<CommonParameters>]
```

```powershell
New-RASCertificate [-Name] <string> [[-SiteId] <uint>] -CertificateFile <string>
 -PrivateKeyFile <string> [-Description <string>] [-Enabled <bool>]
 [-Usage {None | Gateway | HALB | CBAPIServer | CBAPIDataEncryption | CostInsights}]
 [<CommonParameters>]
```

```powershell
New-RASCertificate [-Name] <string> [[-SiteId] <uint>] -PfxFile <string> [-Description <string>]
 [-Enabled <bool>] [-PfxPassword <SecureString>]
 [-Usage {None | Gateway | HALB | CBAPIServer | CBAPIDataEncryption | CostInsights}]
 [<CommonParameters>]
```

```powershell
New-RASCertificate [-Name] <string> [[-SiteId] <uint>] -CommonName <string> -Email <string>
 -LetsEncrypt <SwitchParameter> [-AlternateNames <string>] [-City <string>] [-CountryCode <string>]
 [-Description <string>] [-Enabled <bool>] [-FullStateOrProvince <string>]
 [-KeySize {KeySize1024 | KeySize2048 | KeySize4096 | KeySize3072 | KeySize521 | KeySizeUnknown}]
 [-Organisation <string>] [-OrganisationUnit <string>]
 [-Usage {None | Gateway | HALB | CBAPIServer | CBAPIDataEncryption | CostInsights}]
 [<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.

## EXAMPLES

### Example 1

```powershell
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

```powershell
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

```powershell
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

```powershell
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

## PARAMETERS

### -Name

The name of the target Certificate.

```yaml
Type: string
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -SiteId

Site ID in which to add the Certificate.

```yaml
Type: uint
Required: False
Position: 1
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```

### -Description

A user-defined Certificate description.

```yaml
Type: string
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -PfxFile

Certificate file name in pfx format.

```yaml
Type: string
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -PfxPassword

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

```yaml
Type: SecureString
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -PrivateKeyFile

Private key file name.

```yaml
Type: string
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -CertificateFile

Certificate file name.

```yaml
Type: string
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Usage

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

Possible values: None, Gateway, HALB, CBAPIServer, CBAPIDataEncryption, CostInsights

Type reference: [CertificateUsages](https://docs.parallels.com/landing/ras-powershell-api-guide/rasadmin/types/certificateusages.md)

```yaml
Type: CertificateUsages
Required: False
Position: Named
Default value: Gateway, HALB
Accept pipeline input: False
Accept wildcard characters: False
```

### -Enabled

Whether to enable or disable the certificate being created.

```yaml
Type: bool
Required: False
Position: Named
Default value: True
Accept pipeline input: False
Accept wildcard characters: False
```

### -KeySize

The Key Size for the certificate to be generated.

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

Type reference: [CertificateKeySize](https://docs.parallels.com/landing/ras-powershell-api-guide/rasadmin/types/certificatekeysize.md)

```yaml
Type: CertificateKeySize
Required: False
Position: Named
Default value: KeySize2048
Accept pipeline input: False
Accept wildcard characters: False
```

### -CountryCode

The Country Code for the certificate to be generated.

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

```yaml
Type: string
Required: False
Position: Named
Default value: US
Accept pipeline input: False
Accept wildcard characters: False
```

### -ExpireInMonths

Specifies the length of validity of the certificate being generated.

```yaml
Type: uint
Required: False
Position: Named
Default value: 12
Accept pipeline input: False
Accept wildcard characters: False
```

### -FullStateOrProvince

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

```yaml
Type: string
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -City

The City for the certificate to be generated.

```yaml
Type: string
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Organisation

The Organisation for the certificate to be generated.

```yaml
Type: string
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -OrganisationUnit

The Organisation Unit for the certificate to be generated.

```yaml
Type: string
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Email

The Email for the certificate to be generated.

```yaml
Type: string
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -CommonName

The Common Name for the certificate to be generated.

```yaml
Type: string
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -AlternateNames

The Alternate Names for the certificate to be generated.

eg. IP:1.2.3.4,DNS:example.com

```yaml
Type: string
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -RequestFile

Request file name to output Request Certificate to.

```yaml
Type: string
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -LetsEncrypt

Let's Encrypt SwitchParameter

```yaml
Type: SwitchParameter
Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about\_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

### None

## OUTPUTS

### [Certificate](https://docs.parallels.com/landing/ras-powershell-api-guide/rasadmin/types/certificate.md)

## RELATED LINKS

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.parallels.com/landing/ras-powershell-api-guide/rasadmin/cmdlets/new-rascertificate.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
