简体   繁体   English

使用Azure Release Script上的powershell更新Web.config配置

[英]Update Web.config configuration with powershell on Azure Release Script

I'm running my Deployments on the Release Management(Currently Preview) tool in VSO. 我正在VSO中的发布管理(当前预览)工具上运行我的部署。 When you configure a new Release(with the new release management tool on VSO) you can add to the Flow a task named:Azure PowerShell(Run a PowerShell script within an Azure environment) 配置新版本(使用VSO上的新版本管理工具)时,可以向Flow添加名为的任务:Azure PowerShell(在Azure环境中运行PowerShell脚本)

What i'm trying to do is to Make some changes to the web.config using the Get-WebApplication and then Set-WebConfigurationProperty. 我要做的是使用Get-WebApplication和Set-WebConfigurationProperty对web.config进行一些更改。

the error i get from the Log is: Process should have elevated status to access IIS configuration data. 我从日志中得到的错误是:进程应该具有提升状态以访问IIS配置数据。 ##[error]Cannot find a provider with the name 'WebAdministration'. ## [error]找不到名为“WebAdministration”的提供程序。

Is it even possible to run those kind of commands in there or do you i need to use another kind of command to update my web.config? 甚至可以在那里运行那些命令,还是我需要使用另一种命令来更新我的web.config?

There is no Azure API to make arbitrary transforms to your web.config. 没有Azure API可以对您的web.config进行任意转换。

Instead, the way this is typically done is to use the deployment time transform engine (eg via Web.Debug.config or using Chained Config transforms ). 相反,通常这样做的方式是使用部署时间转换引擎(例如,通过Web.Debug.config或使用链式配置转换 )。

If you're trying to set the web.config of an Azure WebApp then you need to use the Set-AzureWebSite cmdlet or the Set-AzureRMWebApp cmdlet. 如果您尝试设置Azure WebApp的web.config,则需要使用Set-AzureWebSite cmdlet或Set-AzureRMWebApp cmdlet。

Which one you need to use depends on which Azure cmdlets are installed on the machine running the script. 您需要使用哪一个取决于运行脚本的计算机上安装了哪些Azure cmdlet。 The hosted servers for RM may still have the 0.9.x cmdlets (which uses SetAzureWebSite). RM的托管服务器可能仍然具有0.9.x cmdlet(使用SetAzureWebSite)。 The Set-AzureRMWebApp cmdlet is in the 1.x cmdlets. Set-AzureRMWebApp cmdlet位于1.x cmdlet中。 Either will work to set the config, you just need to use the appropriate cmdlet for what's have installed. 要么设置配置,要么只需要使用适当的cmdlet来安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM