Installing Azure Shared VM images on multiple tenants

David Downing 701 Reputation points

I'm trying to install Azure Shared VM images across multiple tenants and I'm trying to determine the best course of action.

We have an Azure App Service that uses an Azure Compute Gallery to deploy VMs. We need this to be able to deploy across tenants.

According to this article: "You cannot use the portal to deploy a VM from an image in another azure tenant. To create a VM from an image shared between tenants, you must use the Azure CLI or PowerShell."

I decided to determine if the Kudu console for the App Service was able to call the appropriate PowerShell scripts necessary to create a VM from the gallery in another tenant.

When I tried to run some basic PS commands; I get the following error:


Is it possible to run az and Azure PowerShell commands from our Web Application? Also the Kudu console?

Is there another way I can write code in my application that will allow deployment of gallery VMs across a tenant?

Thank you,
David Downing

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,414 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,047 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Alan Kinane 16,796 Reputation points MVP

    Try entering this command first, the you should not see that error:


    Note, PowerShell in Kudu is limited somewhat. It's a sandbox environment so you don't get admin rights to install modules and it's PowerShell 5.1

    I usually use Azure Functions if I want to execute some PowerShell, this has version 7 support and you can install modules etc.

    1 person found this answer helpful.