After I blogged about How to send Adaptive Cards with CLI for Microsoft 365 and also used CLI to compare different ways to create SharePoint lists, I found some more commands that made me fall in love with it. CLI for Microsoft 365 has three main benefits from my point of view:
Bonus: Caring maintainers and awesome contributors
In case you never used CLI for Microsoft 365 before, please first read how to get started with CLI Microsoft 365 where I explain how to install the CLI.
My screenshots will show that I work in PowerShell in Visual Studio Code, but you can use any other shell you like to use.
Wouldn't it be nice to get a list of apps? This is what I thought as well. We will look into the CLI for Microsoft 365 documentation find the command to list all Power Apps in this tenant, which gives us an idea, what makers are doing to be able to offer help and support as well.
After having installed CLI and logged in:
m365 pa app list
which will get you exactly that list - with internal names and display names:
If we allowed makers to build their custom connectors to fulfill their unique needs, we might want to look at that as well. If you never create a custom connector, you can read my blog post about how to build a custom connector.
m365 pa environment get --name Default-<name of your default environment>
Now, where do we get this
<name of your default environment> from? This is your tenant ID, which you can obtain from the URL of any Power App running in this environment, or you can copy it from portal.azure.com, where you will find it in Azure Active Directory as Tenant ID.
<name of your default environment>with this Tenant ID
Obtaining a list of users on a specific SharePoint website will be helpful to get their IDs.
m365 spo user list --webUrl "https://m365princess.sharepoint.com/sites/m365princess"by replacing my webUrl with the tenant you are logged in and a site URL you want to query.
The response will be something like this:
Another cool starting point is to get a list of external users. As internal users tend to invite many guests, it could help have an overview of external users and see when these external users were created. You can also obtain the ID of users.
m365 spo externaluser list,
m365 spo user remove --webUrl "https://contoso.sharepoint.com/sites/HR" --id 10 --confirm
we can remove users.
I hope that you now got an idea of how you can get started with CLI for Microsoft 365 :) Shall I blog more about it and show even more commands? Still, I am curious, what would you use it for? Which are the commands that you use every single day? Please comment below!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.