How to setup security for Azure Function so it can send a request to an Azure App Registration and get data from GraphAPI

I am brand new to a lot of Azure technology. I have familiarity with Graph API and JavaScript but have limited knowledge of C#.

Problem:

I need to write an Azure Function that queries an Azure App Registration that has the application permission ‘Reports.ReadAll’ and I need to do this in a secure method. This is to get data from Microsoft Graph Api. I want to do it in a way without writing the App Registrations Client Credentials in the code as that might be risky.

End Goal:

I am planning on collect the response from the App registration call and getting a url to a CSV file which I will Store somewhere (likely SharePoint). But this questions is about the first part, sending a request to the app registration securely and getting a response.

I have done quite a bit of research so far, and it seems I need to achieve my goal by writing a function in C# or JavaScript (preferably JavaScript, but any solution is welcome). To get the security I need some bits on the Internet say I need to Use Azure Key Vault so I am not store Client Credentials in plain text in the code?

I also need to get the bearer token first it seems according to my research, and I need to then include that in the call for the report’s data I need, but I haven’t been having much luck their either.