@Padilla, Henry You need to use below commands for this purpose:
- Copy the certificate at C:\temp\cert.cer or specify your certificate path in step 6.
- Copy the Object ID of the App where you want to add the certificate. You would need this in the last command.
- Open PowerShell as administrator and run Install-Module AzureADPreview. If this module is already installed, you can skip this step.
- Run Connect-AzureAD and login with a user who has Global Administrator or Application Administrator role.
- $cer = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 #create a new certificate object
- $cer.Import("C:\temp\cert.cer")
- $bin = $cer.GetRawCertData()
- $base64Value = [System.Convert]::ToBase64String($bin)
- $bin = $cer.GetCertHash()
- $base64Thumbprint = [System.Convert]::ToBase64String($bin)
- $keyid = [System.Guid]::NewGuid().ToString()
- New-AzureADApplicationKeyCredential -ObjectId 37fe33f9-xxxx-xxxx-xxxx-xxxxxxxxxxxx -CustomKeyIdentifier $base64Thumbprint -Type AsymmetricX509Cert -Usage Verify -Value $base64Value -StartDate $cer.GetEffectiveDateString()
-----------------------------------------------------------------------------------------------------------
Please "mark as answer" or "vote as helpful" wherever the information provided helps you to help others in the community.