Tuning the creation of new CLI apps
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 413
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 21
Description
Hi guys!
The CLI has new functionality in place to create a new application to use the CLI on a Microsoft 365 tenant. We have to run m365 setup and follow the questions to the end. Which is nice!
Now I've been brainstorming with my colleagues who had a few questions about this functionality.
We'd like to tune the process a bit to make it even more user friendly for people who have to use it often. So especially for users regularly working with new tenants, like systems integrators who regularly have new customers this is important.
We thought of the following improvements:
-
Be able to setup the application without reconfiguring the CLI entirely.
If we now runm365 setupit will ask us a lot of questions. But if we're working with the CLI all the time, we generally like to skip that, as we've already configured it to our liking. We don't want it to override our configuration. We just want to create a new app. -
See the tenant name, tenantId and appId when running
m365 connection list
We use custom scripting to determine if we already have a connection with a tenant. If we do not, it should start the setup process. If we do, it should switch to that tenant. -
Be able to specify a custom App Name.
We often work with both PnP PowerShell AND the CLI for Microsoft 365. We want to create an app that's named "M365 Shell tooling" (for example),
How about that? Let's discuss!
As an example, this is the powershell script my colleague wrote, to make working with multiple tenants easier for him.
function Connect-M365Interactive {
[cmdletBinding()]
param (
[parameter(mandatory=$true)]$tenantName
)
$connections = (m365 connection list --output json | ConvertFrom-Json)
$existingConnection = $connections | Where name -eq "$tenantName-interactive"
if($existingConnection) {
m365 connection use --name "$tenantName-interactive"
return
}
$cred = Get-PnPStoredCredential -Name "$tenantName-interactive" -ErrorAction SilentlyContinue
if(!$cred) {
Write-Host "No credential found for $tenantName-interactive"
m365 setup
$connectionData = (m365 cli config list --output json) | ConvertFrom-Json
Add-PnPStoredCredential -Name "$tenantName-interactive" -Username $connectionData.clientId -Password (ConvertTo-SecureString -String $connectionData.tenantId -AsPlainText -Force)
$cred = Get-PnPStoredCredential -Name "$tenantName-interactive"
}
m365 login --tenant $cred.GetNetworkCredential().Password --appId $cred.Username --connectionName "$tenantName-interactive"
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the implementation behind m365 setup and m365 connection list, then review the example PowerShell workflow in the issue. Clarify how setup should preserve existing CLI configuration, expose tenant and app identifiers, and accept a custom app name. Done means each requested workflow is supported and covered by the relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authentication, cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100