'connect to your SharePoint Online environment

I followed https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azuread#setting-up-an-azure-ad-app-for-app-only-access and created powershell script to connect to pnp online:

$certificate = Get-AzKeyVaultSecret -VaultName $keyVaultName -Name $certificateName.SecretValueText
$bstr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($certificate.SecretValue)
$secretPlainText = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($bstr)
Connect-PnPOnline -Url $sharePointUSSiteUrl -ClientId $clientId.SecretValueText -CertificateBase64Encoded $secretPlainText -Tenant "$sharePointTenantName.onmicrosoft.com"

Write-Verbose "Add and publish your app to the App Catalog...."
Add-PnPApp -Path $Path -Scope Tenant -Overwrite -Publish
Write-Verbose "Successfully added and published to the App Catalog"   

On running this, I see this:

VERBOSE: Using parameter set 'App-Only with Azure Active Directory'
VERBOSE: PnP PowerShell Cmdlets (3.29.2101.0): Connected to https://<tenant>.sharepoint.com
VERBOSE: Add and publish your app to the App Catalog....

VERBOSE: Successfully added and published to the App Catalog
Id                                   Title             Deployed AppCatalogVersion InstalledVersion
--                                   -----             -------- ----------------- ----------------
xxxx                                     App             False    1.0.2202.6        

enter image description here

Any idea why my deployment is failing? I created an App in AAD and created a certificate



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source