Search code examples
powershellazure-automationazure-managed-identity

The term 'Select-MgProfile' is not recognized as the name of a cmdlet, function, script file


Help. We are seeing this in an azure automation account on a tenant. We also have a test tenant that Select-MgProfile -Name "beta" is working for.

The automation account is using a managed identity with access to Microsoft Graph Mail.ReadWrite (like the test tenant) - both Powershell 5.1.

Not sure where to look to fix this.

This is the code. It's saying the module is missing, but I have Microsoft.Graph installed in modules on the Azure Automation account.

Connect-MgGraph -Identity 
Select-MgProfile -Name Beta

Select-MgProfile : The term 'Select-MgProfile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:9 char:1 + Select-MgProfile -Name Beta + ~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Select-MgProfile:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

Any ideas where to look?


Solution

  • In the automation|Modules Microsoft.Graph.Authentication shows this was avaiable but it was not. Reinstalling fixed this.