To add or update API permissions for an app, you can use PnP PowerShell. This can be done by using the Grant-PnPAzureADAppSitePermission cmdlet and specifying the app ID, display name, site URL, and permissions. The available permissions are Read, Manage, and FullControl. By granting the necessary permissions, you can avoid the 403 Forbidden error when running the code. For more details and examples, you can refer to the official documentation.
Login now to access my digest by 365.Training