Hi @john john ,
I would rather recommend you to take first approach.In second link ,such as SharePointPnPCoreOnline and Microsoft.Azure.KeyVault which are now deprecated and are not maintained.The first approach use CSOM will be better for you.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.