if you are not tied to coding in C#, you could use node and Playwright (a Microsoft npm package)
https://www.npmjs.com/package/playwright
a sample of azure function (node) using playwright:
https://dotnetthoughts.net/running-playwright-on-azure-functions/
a sample of azure static web app