cli-microsoft365: CI/CD --> 'm365' is not recognized as an internal or external command, operable program or batch file.
Hi @AkashSatoliya, I created a separate issue for this as the comment trails might overlap otherwise.
Hi @martinlingstuyl,
I am also getting the same error. I am trying to create CD pipeline in Azure DevOps to deploy sppkg to SharePoint. I was getting error “The system cannot find the file specified.” when running task to login to Sharepoint.
When I tried to login using m365 cli on one of my VM I was getting the same error:
m365 login --authType password --userName user@contoso.com --password ***
The system cannot find the file specified.
When I ran “npm view @pnp/cli-microsoft365” to check details on m365 CLI, I got below output:
C:\Users\User>npm view @pnp/cli-microsoft365
@pnp/cli-microsoft365@5.6.0 | MIT | deps: 24 | versions: 488
Manage Microsoft 365 and SharePoint Framework projects on any platform
https://pnp.github.io/cli-microsoft365/
keywords: office 365, microsoft 365, sharepoint framework, o365, m365, spfx, sha
repoint online, sharepoint, microsoft teams, microsoft graph, microsoft flow, az
ure active directory, azure ad, azure, microsoft
bin: m365, m365_comp, microsoft365
But When I run “m365 version” I’m getting below error:
C:\Windows\system32>m365 version
'm365' is not recognized as an internal or external command,
operable program or batch file.
Nodejs path(C:\Program Files\nodejs) was already included in PATH variable.
nodejs version: V14.15.0 Operating system: Windows Shell: PowerShell
__Originally posted by @AkashSatoliya in https://github.com/pnp/cli-microsoft365/issues/3565#issuecomment-1223752643__
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 97 (52 by maintainers)
Hi @martinlingstuyl,
Disabling MFA worked. After disabling MFA I’m able to deploy the site and upload files to site assets.
Thank you so much @martinlingstuyl and @waldekmastykarz for getting to the bottom of the problem and providing its solution.
Hi @martinlingstuyl ,
Yes, it is correct. The solution provided is to disable MFA. I’ve raise request to disable MFA for the account. The MFA cannot be disabled and instead they’ll whitelist Microsoft DevOps IP addresses which will not ask for MFA. It is still waiting for security approval. I’m not sure how much time it will take to get the approval. Hence if required, please close this thread. I’ll Update as soon as I get approval and try the solution.
Hi @AkashSatoliya, I’ve been at a conference this week. No time to respond. I’ll get back to you!
That’s great to hear @AkashSatoliya! It took a while, but we finally got there! Thanks a lot for your patience 👍
And thank you for sticking with us and not giving us. I’m sure the information we’ve got in this thread will help others too.
Thank you for the recap. If there are additional things that we’re checking, we can keep this thread open. I just want to ensure that it’s still active 😃
Yes, and it should work. Incidentally, it also works on my machine when using the full path. 😃 But something odd is going on with your PC and your use of quotes. I’m not sure what or how.
Ok, I’m still curious whether that solves it on your local Pc though. Just for future reference. 🤗 who knows, someone else might come up with the same issue.
I do think you might need to escape (at least) the dollar sign with a backtick:
“&1zxc098!@#`$%^()”
Hi @martinlingstuyl,
Finally, I’ve received new account. The new account is an AAD account, MFA disabled and has admin permissions.
I tried for device login using
m365 login
command. It gave a code which I entered in https://microsoft.com/devicelogin. After that I tried to login using commandm365 login -t password -u "someupn@contoso.com" -p "&zxc098!@#$%^*()"
in both PowerShell and command prompt. This resulted in below error:The password includes
&
hence I tried adding back tick before&
in password like `&zxc098!@#$%^*(). But it still resulted in errorHi @martinlingstuyl ,
Still awaiting for account. Received an updated that I’ll get it in couple of days.
And another one: I’m assuming it’s an Azure AD cloud account? Hybrid federation to AD using for example ADFS is not supported, unless pass through auth is enabled.
Hi @martinlingstuyl
Thank you so much for looking into it. I’ve requested for permissions. I’ll update once permission is granted and I’m able to test it.
it’s 5.7.
Hi @martinlingstuyl,
When trying with
$(password)
it results in variable reference error. PowerShell works with${password}
and$password
. When tried with${password}
and$password
it tries to login and fails with network error.@martinlingstuyl,
Thank you for your suggestion.
I have tried running command with PowerShell instead of command tasks.
With above script I’m not getting error for m365 command. It attempts to login but fails with below error
As per this document it is known issue with m365 cli and it has been resolved in m365 cli version 5.5. However I’m using m365 cli v5.6.0 but still getting this error.
Hi @AkashSatoliya,
What’s the content of your $PATH? Maybe some node.js folder is in it. In that case you could change the place where the
npm install
globally installs the packages to something already in the PATH. You can do this using an environmentvariablenpm_config_cache
, or using the--prefix
optionYou could also install the cli package locally (
npm install @pnp/cli-microsoft365
) and run the executable something like this: