Get-MsIdCBACertificateUserIdFromCertificate
SYNOPSIS
Generates an object representing all the values contained in a certificate file that can be used in Entra ID for configuring CertificateUserIDs in Certificate-Based Authentication.
SYNTAX
Get-MsIdCBACertificateUserIdFromCertificate [[-Path] <String>] [[-Certificate] <X509Certificate2>]
[[-CertificateMapping] <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION
Retrieves and returns an object with the properties 'PrincipalName', 'RFC822Name', 'IssuerAndSubject', 'Subject', 'SKI', 'SHA1PublicKey', and 'IssuerAndSerialNumber' from a certificate file for use in CertificateUserIDs configuration in Certificate-Based Authentication, according to the guidelines outlined in the Microsoft documentation for certificate-based authentication
EXAMPLES
EXAMPLE 1
Get-MsIdCBACertificateUserIdFromCertificate -Path "C:\path\to\certificate.cer"
This command retrieves all the possible certificate mappings and returns an object to represent them.
EXAMPLE 2
Get-MsIdCBACertificateUserIdFromCertificate -Certificate $cert
This command retrieves all the possible certificate mappings and returns an object to represent them.
EXAMPLE 3
Get-MsIdCBACertificateUserIdFromCertificate -Path "C:\path\to\certificate.cer" -CertificateMapping Subject
This command retrieves and returns the PrincipalName property.
PARAMETERS
-Path
The path to the certificate file. The file can be in .cer or .pem format.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Certificate
An X509Certificate2 object
Type: X509Certificate2
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-CertificateMapping
The certificate mapping property to retrieve. Valid values are PrincipalName, RFC822Name, IssuerAndSubject, Subject, SKI, SHA1PublicKey, and IssuerAndSerialNumber.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```powershell
### 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](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
## OUTPUTS
### Returns an object containing the certificateUserIDs that can be used with the given certificate.
### ```
### @{
### PrincipalName = "X509:<PN>bob@woodgrove.com"
### RFC822Name = "X509:<RFC822>user@woodgrove.com"
### IssuerAndSubject = "X509:<I>DC=com,DC=contoso,CN=CONTOSO-DC-CA<S>DC=com,DC=contoso,OU=UserAccounts,CN=mfatest"
### Subject = "X509:<S>DC=com,DC=contoso,OU=UserAccounts,CN=mfatest"
### SKI = "X509:<SKI>aB1cD2eF3gH4iJ5kL6mN7oP8qR"
### SHA1PublicKey = "X509:<SHA1-PUKEY>cD2eF3gH4iJ5kL6mN7oP8qR9sT"
### IssuerAndSerialNumber = "X509:<I>DC=com,DC=contoso,CN=CONTOSO-DC-CA<SR>eF3gH4iJ5kL6mN7oP8qR9sT0uV"
### }
### ```
## NOTES
## RELATED LINKS