To prevent security vulnerabilities, it is important that your browser does not execute code outside of its sandbox environment. Instead, consider utilizing the Azure Key Vault SDK for JavaScript (specifically designed and optimized for TypeScript) to securely retrieve secrets.
User authentication is necessary in this process. Typically, backend authentication is used, where your web service authenticates the user and either impersonates them or directly makes the request on behalf of the website if the user has appropriate access permissions. This scenario is more common.
If your goal is simply to fetch a secret for your webpage, using PowerShell may be unnecessary. If you are looking for guidance on user authentication in this context, please provide further details and consider adjusting tags to clarify why PowerShell is being considered over alternative methods that also involve authentication and authorization.