Aleks G
Aleks G

Reputation: 57316

Apply applicationHost transform when deploying to Azure Cloud Service

I am deploying in Azure using Cloud Service. I need to add global url rewrite rule in each of the nodes. These global rewrite rules are stored in the applicationHost.config file and the way I read it, this file can be modified using the xml transform method.

I've prepared my applicationHost.xdt file - but how do I get this transform to run when deploying the cloud service?

Note, there are plenty of examples/articles that describe how to deploy/run it in azure application service. I need to do it in a cloud service instead, which is different.

Upvotes: 0

Views: 325

Answers (1)

kwill
kwill

Reputation: 10998

Isn't the applicationHost.xdt only for App Service environments (ie. Web Apps)? As far as I know it isn't a generic applicationHost.config transform for use outside of Web Apps.

For cloud services you would use a startup task to automate appcmd commands. For example - https://learn.microsoft.com/en-us/azure/cloud-services/cloud-services-startup-tasks-common#block-a-specific-ip-address:

@echo off
@echo Installing "IPv4 Address and Domain Restrictions" feature 
powershell -ExecutionPolicy Unrestricted -command "Install-WindowsFeature Web-IP-Security"
@echo Unlocking configuration for "IPv4 Address and Domain Restrictions" feature 
%windir%\system32\inetsrv\AppCmd.exe unlock config -section:system.webServer/security/ipSecurity

Upvotes: 0

Related Questions