gpt4 book ai didi

powershell - Visual Studio 在线构建和发布 Azure Powershell

转载 作者:行者123 更新时间:2023-12-02 23:54:00 27 4
gpt4 key购买 nike

我们最初在 powershell 脚本中使用 Start-AzureWebsite 和 Stop-AzureWebsite 在发布之前启动和停止 Azure 中的 Web 应用程序。在 VSO 构建中,它使用 Azure Powershell,连接类型为 Azure Classic。 Microsoft 建议切换到使用 Azure 资源管理器的 Start-AzureRmWebApp 和 Stop-AzureRmWebApp。我们修改了构建中的 Azure Powershell 步骤,以具有 Azure 资源管理器的连接类型,并选择了正确的订阅。当它使用脚本路径调用我们的外部脚本时,身份验证似乎没有传递到脚本,我们收到错误“运行 Login-AzureRmAccount 进行登录”。当它尝试执行命令来启动/停止网站时。我们如何让身份验证持续到被调用的脚本?

最佳答案

不确定为什么连接会丢失,如果您点源脚本来调用它,它应该可以工作。但是:

我建议在 AAD 中创建一个链接到您的订阅的服务主体,并授予其访问您的 Web 应用程序的权限。然后,您应该使用现有 Azure App Service Manage 任务来启动/停止您的应用程序:

enter image description here顺便说一句,启动/停止/部署网络应用程序应该是发布定义/步骤的一部分 - 而不是构建。 -

关于powershell - Visual Studio 在线构建和发布 Azure Powershell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50720131/

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