gpt4 book ai didi

azure - 我可以通过 ARM 模板运行 powershell 脚本吗?

转载 作者:行者123 更新时间:2023-12-05 08:18:55 26 4
gpt4 key购买 nike

我想运行 powershell 脚本来在 Azure AD 中创建用户和用户组。 ARM Template中可以调用ps脚本吗?

最佳答案

更新:现在可以使用新功能执行一些操作(仍处于预览版)

https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deployment-script-template

Use deployment scripts in templates (Preview)

Learn how to use deployment scripts in Azure Resource templates. Witha new resource type called Microsoft.Resources/deploymentScripts,users can execute deployment scripts in template deployments andreview execution results. These scripts can be used for performingcustom steps such as:

  • add users to a directory
  • create an app registration
  • perform data plane operations, for example, copy blobs or seed database
  • look up and validate a license key
  • create a self-signed certificate
  • create an object in Azure AD
  • look up IP Address blocks from custom system

The benefits of deployment script:

  • Easy to code, use, and debug. You can develop deployment scripts in your favorite development environments. The scripts can be embedded intemplates or in external script files.
  • You can specify the script language and platform. Currently, only Azure PowerShell deployment scripts on the Linux environment aresupported.
  • Allow specifying the identities that are used to execute the scripts. Currently, only * * Azure user-assigned managed identity issupported.
  • Allow passing command-line arguments to the script.
  • Can specify script outputs and pass them back to the deployment.

请记住,ARM 模板应该是幂等的。您应该编写可以多次执行的代码,即使在代码已经执行过的环境中也是如此。例如,如果您要配置设置或创建资源,您的 powershell 可能应该检查资源是否已就位并正确配置。

关于azure - 我可以通过 ARM 模板运行 powershell 脚本吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47806785/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com