I have some secret key which is presently in the git repo of angular code, which is not secure - I want them to be read from the Azure key vault from angular code.
我有一些密钥,目前在angular代码的git repo中,这是不安全的——我希望从angular代码中从Azure密钥库中读取它们。
Any help or suggestion will be appreciated.
如有任何帮助或建议,我们将不胜感激。
更多回答
If you read the Key Vault secret to your Angular front-end, it will be visible to users of your app, is that ok? Of course you can do the read by authenticating the user with Azure AD and then reading it on their behalf (meaning the user had read access anyway).
如果你向Angular前端读取密钥库秘密,你的应用程序用户就会看到它,可以吗?当然,你可以通过使用Azure AD对用户进行身份验证,然后代表他们进行读取(这意味着用户无论如何都有读取权限)来进行读取。
Is there any sample you have that shows how to read it from angular code?
你有没有任何样本可以展示如何从角度代码中读取它?
优秀答案推荐
Managed identities are helpful to allows your app to easily access other Azure AD-protected resources such as Azure Key Vault
托管身份有助于让您的应用程序轻松访问其他受Azure AD保护的资源,如Azure密钥库
Please try below steps to access Key Vault
请尝试以下步骤访问密钥库
- Create Managed identity in Azure and Add role assignment to read Key Vault
- If your application is deployed in Azure App Service, go to Settings --> Identity --> User Assigned.
- Add the identity created earlier in step 1
If the application in deployed in Azure VM, managed identity can be added to VM. Please refer to the documentation for more details on managed identity
如果应用程序部署在Azure虚拟机中,则可以将托管身份添加到虚拟机中。有关托管身份的更多详细信息,请参阅文档
https://learn.microsoft.com/en-us/azure/app-service/overview-managed-identity?tabs=portal%2Chttp
https://learn.microsoft.com/en-us/azure/app-service/overview-managed-identity?tabs=portal%2Chttp
更多回答
Yes, our backend api is already fetching it from azure key vault by managed identity in AD.
是的,我们的后端api已经通过AD中的托管身份从azure密钥库中获取了它。
Looking for Angular code sample - which can read the vault value
寻找Angular代码示例-可以读取vault值
我是一名优秀的程序员,十分优秀!