cli-microsoft365 icon indicating copy to clipboard operation
cli-microsoft365 copied to clipboard

Bug report: Some examples for the 'login' command do not mention the other necessary options you need: tenant and appId

Open martinlingstuyl opened this issue 3 years ago • 6 comments

Description

Check out this example:

m365 login --authType secret --secret topSeCr3t@007

That's not a good example, as it would not log you in successfully. You need the --appId value as well. And if your app registration is configured as single tenant, you will need the --tenant option as well. Otherwise you get an error. An example should be able to be run as it is (with the right values), so we should add the options here.

All the examples for logging in with a certificate, have the same deficiency and should be fixed as well.

martinlingstuyl avatar Sep 30 '22 05:09 martinlingstuyl

We should also mention that if you use the login with a custom appId you need to specify the tenant if your app is not multi tenant. Feels like we can pick that up in this same issue.

appieschot avatar Sep 30 '22 09:09 appieschot

Updated it

martinlingstuyl avatar Sep 30 '22 09:09 martinlingstuyl

That's not a good example, as it would not log you in successfully. You need the --appId value as well. And if your app registration is configured as single tenant, you will need the --tenant option as well. Otherwise you get an error.

I think it would work if the values are set in an environment variable, but I do agree that it's not clear, so we should either expand the sample's code or mention it specifically in the sample's description that precedes the code.

waldekmastykarz avatar Sep 30 '22 15:09 waldekmastykarz

I see what you mean. I'm in favor of expanding the samples. Using env variables, while a possibility is not the primary mode to work, I think.

We could add an extra note about the possibility to use env variables...

martinlingstuyl avatar Sep 30 '22 21:09 martinlingstuyl

Using env variables, while a possibility is not the primary mode to work, I think.

I think it all depends on the use case. I think you're unlikely to login interactively with a secret or cert, because these options are typically used in the context of automation with app-only access, where you might define app- and tenant ID in env vars. There's no harm in adding an extra explanation to the existing sample saying that it assumes specific values are set in env vars, and then adding another version where app- and tenant ID are specified through args.

waldekmastykarz avatar Oct 08 '22 18:10 waldekmastykarz

Since this does not seem to have much interest, so I will take it

Adam-it avatar Nov 29 '25 22:11 Adam-it