从VSTS发行期间修改Azure AppService ipsecurity [英] Modify Azure AppService ipsecurity during release from VSTS

查看:81
本文介绍了从VSTS发行期间修改Azure AppService ipsecurity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将新的IP地址添加到Azure AppService的白名单中.我无法使用XML Transformation或仅替换标记,因为所需的新条目列表将在发布开始时而不是之前获得.我也无法修改压缩站点的内容(用/p:DeployOnBuild = True发布).部署是使用"Azure App Service Deploy"任务完成的.我知道Set-AzureRMWebApp cmdlet,但它仅允许修改appSettings和connectionStrings部分.还有其他解决方案吗?

I am trying to add new ip addresses to the whitelist of Azure AppService. I am unable to use XML Transformation or simply replace tokens as the needed list of new entries will be obtained in the beginning of the release and not before. I am also unable to modify the content of the zipped site (published with /p:DeployOnBuild=True). The deployment is done using "Azure App Service Deploy" task. I know of Set-AzureRMWebApp cmdlet but it only allows to modify the appSettings and connectionStrings sections. It there any other solution?

推荐答案

使用Set-AzureRMResource PowerShell命令:

Using Set-AzureRMResource PowerShell command:

$r = Get-AzureRmResource -ResourceGroupName "Resoucegroup name" -ResourceType Microsoft.Web/sites/config -ResourceName resourcename/web -ApiVersion 2016-08-01

$p = $r.Properties
$p.ipSecurityRestrictions = @()
$restriction = @{}
$restriction.Add("ipAddress","0.0.0.0")
$restriction.Add("subnetMask","0.0.0.0")
$p.ipSecurityRestrictions+= $restriction

Set-AzureRmResource -ResourceGroupName  "Resoucegroup name" -ResourceType Microsoft.Web/sites/config -ResourceName resourcename/web -ApiVersion 2016-08-01 -PropertyObject $p

一个相关线程: Azure使用Powershell的Resource Manager IP安全限制

另一种方法是您可以使用FileSystem方法发布项目:

Another way is that you can publish project with FileSystem method:

一些构建任务:

  1. Visual Studio构建(MSBuild参数:/p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:publishUrl="$(build.artifactstagingdirectory)\\" /p:DeployDefaultTarget=WebPublish)
  2. 发布构建工件(发布路径:$(build.artifactstagingdirectory))

发布任务:

  1. 替换令牌或其他任务来更新web.config(可以使用文件转换和变量替换在Azure App Service部署任务中)
  2. Azure App Service部署(1.取消选中使用WebDeloy选项发布2.程序包或文件夹:$(System.DefaultWorkingDirectory)
  1. Replace token or Other tasks to update web.config (Could use File Transform & Variable Substitution in Azure App Service Deploy task)
  2. Azure App Service Deploy (1. Uncheck Publish using WebDeloy option 2. Package or folder: $(System.DefaultWorkingDirectory)

这篇关于从VSTS发行期间修改Azure AppService ipsecurity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆