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?
Update: 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.
To install PowerShell modules manually, you first need to determine your current PowerShell module directory path, download your new module to that path, and invoke the import-module command to let windows know it's there.
Installing powershell modules is simple, right? Open a powershell window and use the Find-Module cmdlet or if you know the name of the module go straight to Install-Module. This will connect to the powershell gallery and download and install the module for you.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With