Install powershell module in Azure app service

Frank Zhang (BEYONDSOFT CONSULTING INC) 0 Reputation points Microsoft External Staff
2023-04-28T22:30:49.16+00:00

We are running an asp.net core API project in Azure app service, one of our new features needs to install a PowerShell module ExchangeOnlineManagement. What is the best approach to install ps module in the Azure app service?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,934 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Dillon Silzer 57,826 Reputation points Volunteer Moderator
    2023-04-29T01:52:19.82+00:00

    Hello Frank,

    You should consider using Azure Functions with PowerShell:

    https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-powershell?tabs=portal


    If this is helpful please accept answer.

    0 comments No comments

  2. Grmacjon-MSFT 19,151 Reputation points Moderator
    2023-05-02T03:33:08.6933333+00:00

    Hi @Frank Zhang (BEYONDSOFT CONSULTING INC) ,

    you can use the Kudu console to install a PowerShell module in an Azure App Service

    -First open the Kudu console for your App Service. You can do this by navigating to your App Service in the Azure portal, clicking on "Advanced Tools" in the left-hand menu, and then clicking on "Go" under "Kudu".

    -Once you are in the Kudu console, click on "Debug Console" in the left-hand menu and select "PowerShell".

    -In the PowerShell console, run the following command to install the ExchangeOnlineManagement module:

    Install-Module ExchangeOnlineManagement

    -Wait for the module to finish installing. Once it's done, you can close the PowerShell console.

    In your ASP.NET Core API project, you can use the Import-Module cmdlet to import the ExchangeOnlineManagement module and use its cmdlets.

    The current version of Azure PowerShell is 9.7.1. For information about the latest release, see the release notes. PowerShell version 7 or higher is the recommended version of PowerShell for use with the Az PowerShell module on all platforms including Windows, macOS, and Linux.

    Hope that helps.

    -Grace

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.