Animesh Anand
Animesh Anand

Reputation: 128

New-JournalRule cmdlet not recognized when trying to use with EXO V2 (with app based authentication)

It appears the New-JournalRule cmdlet is not available in ExchangeOnline(EXO) V2 module. When trying to use this cmdlet I get the error,'The term 'New-JournalRule' is not recognized...'

I get the error after importing the V2 module and connecting. Also, I get the same error when trying to use the cmdlet in PS implicit remoting.

Import-Module "ExchangeOnlineManagement.psd1" -Verbose Connect-ExchangeOnline (Invoke-Command -Session (Get-PSSession) -ScriptBlock {New-JournalRule})

With EXO V1, I am getting the cmdlet.

Has anyone seen this issue and have an pointers or workaround for this in EXO v2?

Edit: New-JournalRule cmdlet does appear when I connect using the cmdlet:

Connect-ExchangeOnline -UserPrincipalName myusername -ShowProgress:$true

However, when I connect using the cmdlet below, I don't get find the cmdlet and get the error

Connect-ExchangeOnline -AppId 'appid' -CertificateFilePath "Cert.pfx" -Organization 'xyz.onmicrosoft.com' -CertificatePassword (ConvertTo-SecureString 'myapss' -AsPlainText -Force) -LogLevel Default -Verbose

Upvotes: 1

Views: 212

Answers (1)

Animesh Anand
Animesh Anand

Reputation: 128

The cmdlet was available when the app's role was set to 'Exchange Administrator' in Azure AD. Prior to this the app's role was set to 'Global Reader'. When the cmdlet was seen with the UPN login, then I thought it may have to do something with the app configuration.

I was not aware there was this capability to hide the cmdlet based on the app role. I did not find any docs for this.

Hope someone else who is facing this issue finds this useful.

Upvotes: 1

Related Questions