[英]How to retrieve UserName and Password in unattended Azure Function
I have a runbook that is currently executed via a webhook call in order to execute some powershell code on a site.我有一个当前通过 webhook 调用执行的运行手册,以便在站点上执行一些 powershell 代码。 This is been working great.
这一直很好用。
I have been instructed to convert this code to an Azure function. No big deal, right?我被指示将此代码转换为 Azure function。没什么大不了的,对吧? Well.... I was able to get it set up without too much trouble - I created it in VS Studio and then deployed to Azure. The problem is that in the code I need to log in and my username and password are hard-coded in the script.
好吧....我能够毫不费力地设置它 - 我在 VS Studio 中创建它然后部署到 Azure。问题是在代码中我需要登录并且我的用户名和密码很难 -在脚本中编码。 When I had run this in the runbook I called a Credential stored in the Automation account but that does not seem to be an option here.
当我在 runbook 中运行它时,我调用了一个存储在自动化帐户中的凭据,但这似乎不是这里的一个选项。
I have seen other people ask the same question and the answer is often "application settings", which of course is not protected.我见过其他人问过同样的问题,答案通常是“应用程序设置”,这当然不受保护。
This is to run unattended so I (obviously) can't ask for credentials.这是在无人值守的情况下运行,所以我(显然)不能要求提供凭据。 I am running PowerShell 7.
我正在运行 PowerShell 7。
Any help would be greatly appreciated.任何帮助将不胜感激。
You can use Key vault references with Azure Function App to access secrets.您可以将密钥保管库引用与 Azure Function 应用程序一起使用来访问机密。 You can protect your secrets stored in Key vault using RBAC .
您可以使用 RBAC保护存储在 Key vault 中的机密。 Azure function app also provides integration with AAD where you can use Identity instead of secrets.
Azure function 应用程序还提供与 AAD 的集成,您可以在其中使用身份而不是密码。 Additionally you can go through this document regarding more information on securing Azure Functions.
此外,您可以 go 通过此文档了解有关保护 Azure 功能的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.