I'm trying to run my Powershell PnP script using ClientId and ClientSecret instead of UseWebLogin. I already created an Azure Application ID using this tutorial (but skipping the certificate part for the moment):
This is my code:
#Install-Module SharePointPnPPowerShellOnline
#Config Variables
$SiteURL = "https://myname.sharepoint.com/"
Try {
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -ClientId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -ClientSecret "Sdf9Q~9pZErHkefW0Zt77IryFh-6vk_vI6B-Fch2"
Get-PnPsite
Disconnect-PnPOnline
}
catch {
write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
}
I get this error:
Get-PnPsite : Cannot contact site at the specified URL https://myname.sharepoint.com/. The app principal does not exist. At line:9 char:1
Using the UseWebLogin all is working.
What did I do wrong or miss in creating the Azure Application?

-Tenantargument? For example:-Tenant 'myname.onmicrosoft.com'The app principal does not exist.