I'm facing an issue with running a script in my Azure Runbook. I'm using PowerShell 7.4 with the ExchangeOnlineManagement module, and I have a cloud-only Exchange setup. My script includes connecting with a managed identity that has the necessary permissions, but when I try to execute the Set-Mailbox command, I get an error saying it's unrecognized. Other commands like Get-Mailbox and Add-DistributionGroupMember work fine. Has anyone dealt with a similar issue?
5 Answers
You might want to try using the set-exomailbox command instead. It sometimes works better in specific environments.
Are you sure the managed identity has the right roles assigned? It seems like it might not have the necessary permissions if it can't recognize Set-Mailbox.
Make sure to use the import command for the module. You can check with a verbose command to ensure that it's showing up as expected.
Did you import the module correctly in your Automation Account? That can be a common oversight.
This sounds like it could be a permissions issue or a problem with the module installation. I'd recommend creating an app registration with the necessary permissions you mentioned. Test out the script locally first to ensure everything works before moving to the runbook with managed identity.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically