I am working on an internal tool that is meant to automatize app deployment on Azure. It is actually an MVC application where a user can upload zip-packages containing other apps and afterwards those get deployed on Azure (each of them to its own app service). Until now I was using “Microsoft.Azure.Management.Fluent” in C# which made things easy. Unfortunately it didn’t allow me to make the kind of configurations I needed to make especially on Application gateway. Fortunately PowerShell does. I have already wrote the script that does everything I need. I can publish that script in my azure web app. The problem is that
AzureRM module (which is a required module) is missing there. Also, I am not able to install it since I get an “You are not an administrator…” error (likely because I’m not an administrator on the actual Azure web app). Any ideas on how to install a PS module in an Azure web app?
I know I can use Azure API in order to achieve my goal, but I would like to be able to run a normal PowerShell script (at least it’s more readable).
Update 2 🙂
It seems like there is no way to install a PS module beside an web app since resources are shared and so on. I have decided to abandon using powershell with azureRM and execute api calls from my c# app.
You can try to install the module version you need to the current user environment (use Az module instead of AzureRM):
Install-Module -Name Az.Websites -Scope CurrentUser
Tale a note that AzureRM is not recommended anymore:
Because Az PowerShell modules now have all the capabilities of AzureRM
PowerShell modules and more, we’ll retire AzureRM PowerShell modules
on 29 February 2024.
We do not support having both the AzureRM and Az modules installed for
PowerShell 5.1 on Windows at the same time.