Question: I would like to change the vmsize of a running Azure web role during deployment preferrably using powershell. 

Is this at all possible?

The use case here is that not all of our customers (and test environments) should run the same vm sizes, but they all use the same .csdef file.

Answer: 
This is not possible for a role, you have to do a new deployment with the settings change. You can however change the number of instances without redeploying maybe that could help you out?

On plain VM's you can use the following powershell snippet:

```
Get-AzureVM –ServiceName $ServiceName –Name $Name | 
Set-AzureVMSize $VMSize | 
Update-AzureVM

```

[Taken from here](https://msdn.microsoft.com/en-us/library/dn168976%28v=nav.70%29.aspx)
We use `MSBuild` to convert VM size in Service Definition file. It's part of the build step that runs before the deployment.

```
<Target Name="ChangeVM">
  <RegexReplace
    Pattern='vmsize="Standard_D3"'
    Replacement='vmsize="$(VMSize)"'
    Files='../Web/ServiceDefinition.csdef' />
</Target>

```

Where `(VMSize)` is the parameter coming from your build server.