Unable to commit WebAdministration changes in Azure Web Role Unable to commit WebAdministration changes in Azure Web Role azure azure

Unable to commit WebAdministration changes in Azure Web Role


Make sure your role is running with elevated privileges.


I think there are two questions here. Firstly the use of IIS in Azure. Yes using the 1.3 SDK means that we now have access to more features than we did previously. This means that we can setup more than one site and virtual directories for our sites in the configs as shown in the training kit.

Secondly there is the privileges issue that you're getting while trying to make changes programatically. I'm going to presume that you're not trying to do one of the things that you can simply do through the config above. The most likely reason your code is erroring is because web roles are not run with admin privileges. Fortunately in the 1.3 SDK we also have a way to run code with elevated privileges. As shown elsewhere in the training kit you can create a separate .exe that you specify to be run at startup with elevated privileges in the config.


Providing a clear example for reference to @smarx answer.

Here is the configuration to run RoleEntryPoint.OnStart (WebRole.Onstart) with Admin-level privileges.

<ServiceDefinition name="MyProject.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">  <WebRole name="MyProject.WebRole" vmsize="Small">    <Runtime executionContext="elevated"/> <!-- Required for certain WebRoleOnStart tasks (avoid insufficient permission errors) -->    <Sites>       <!-- ... -->    </Sites> </WebRole></ServiceDefinition>