Running Powershell Scripts Across Tenants using Az Automation and System-Assigned Managed Identity

ash7f 20 Reputation points
2024-10-15T07:08:00.6533333+00:00

I have some Exchange Online PS scripts that I'm running in my own tenant using system-assigned managed identity to avoid interactive and certificate based sign in. Is it possible to run those scripts in another tenant? Say, for example, a customer wants me to run scripts to generate reports for some mail related info in their own tenant. Is there a way that I can run those scripts without having to sign in to the customer's tenant? Maybe if they provide me with their managed identity and possibly other permissions?

I've been doing loads of research but I have a very vague idea and not sure if this is an achievable approach or if there's another option.

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,171 questions
Windows for business Windows Server User experience PowerShell
Microsoft Security Microsoft Entra Microsoft Entra ID
{count} votes

Accepted answer
  1. Vasil Michev 119.5K Reputation points MVP Volunteer Moderator
    2024-10-15T16:22:05.8+00:00

    No, unless you have access to their Azure environment. You can use a generic multi-tenant service principal instead, but they do need to consent to the required permissions (Exchange.ManageAsApp), and you will need to provide client secret or certificate to authenticate.

    3 people found this answer helpful.

0 additional answers

Sort by: Most helpful

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.