Enhancement:
When executing the purview retentionlabel and purview retentioneventtype get commands, we will get a notification that we do not have the necessary permissions when using application-only permissions.
We should add the following lines in the commandAction of every command and update the tests. We also should add a remark to the docs.
if (accessToken.isAppOnlyAccessToken(auth.service.accessTokens[this.resource].accessToken)) {
this.handleError('This command does not support application permissions.');
}
Original issue:
Description
Currently, when we execute for example purview retentionlabel list while using application permissions, we will get the following error:

After doing some research, I noticed that this was due to me using the application permissions. After logging in using devicecode and a custom app registration with the permission RecordsManagement.ReadWrite.All, it started working
I think that we should add a piece of code that checks if we are using appOnlyAuth and throw an error if this is the case
The error occurs on the following commands
- purview retentionlabel add
- purview retentionlabel get
- purview retentionlabel list
- purview retentionlabel remove
- purview retentionlabel set
- purview retentioneventtype get
Steps to reproduce
- Login using --authType secret and a custom application registration
- Execute command
m365 purview retentionlabel list
Expected results
List of retention labels
Actual results
Error:

Enhancement:
When executing the
purview retentionlabelandpurview retentioneventtype getcommands, we will get a notification that we do not have the necessary permissions when using application-only permissions.We should add the following lines in the
commandActionof every command and update the tests. We also should add a remark to the docs.Original issue:
Description
Currently, when we execute for example

purview retentionlabel listwhile using application permissions, we will get the following error:After doing some research, I noticed that this was due to me using the application permissions. After logging in using devicecode and a custom app registration with the permission
RecordsManagement.ReadWrite.All, it started workingI think that we should add a piece of code that checks if we are using
appOnlyAuthand throw an error if this is the caseThe error occurs on the following commands
Steps to reproduce
m365 purview retentionlabel listExpected results
List of retention labels
Actual results
Error:
