Manage Microsoft 365 and SharePoint Framework projects on Photon OS - dcasota/photonos-scripts GitHub Wiki
Collaboration with internal and external teams is a key factor. Utilizing Microsoft 365 promises collaboration flexibility.
In this wiki, VMware Photon OS is combined with open source cmdline tools for managing Microsoft 365 and Sharepoint Framework projects. The modules used are MS Powershell pnp.powershell and Nodejs cli-microsoft365.
Lab-Environment
Hardware
- a Photon OS 4.0 bare metal or virtual machine
Installation
-
Configure Photon OS environment to allow a specific communication port eg. port 80.
-
run
sudo docker run -p 80:80/tcp -it $(sudo docker build -q .)
Known issues
- Installing the bits with
tdnf install cli-microsoft365
would be super easy. - ttyd shows up with ttyd 1.6.3-2b4dbac (libwebsockets 4.2.1-unknown), it would be helpful to avoid libwebsockets culprits. There seems no package libwebsockets?
- the webconsole created with ttyd+tini doesn't seem to allow bash history. The output just is "OA" (up) and not the last bash command. Any idea how to fix this on Photon?
- Securing the docker container with a non-root user fails (permission denied) when creating the file ~/.bash_profile. I couldn't figure out why. The dockerfile had two additional entries
RUN useradd --system cli-microsoft365-on-photon USER cli-microsoft365-on-photon
with a workdir specified as /home/cli-microsoft365-on-photon
.
- Sharegate cmdlets do not work on Linux as they need Windows assemblies of the .NET framework.
Here some screenshots of a web browser window with the powershell console
Connect to the powershell web console
Login with m365 login
Create a Sharepoint Team Site
Azure Active Directory User administration
CLI for Microsoft 365 supports actually a few user administration tasks.
m365 aad user --help
CLI for Microsoft 365 v5.2.0
Manage Microsoft 365 and SharePoint Framework projects on any platform
Commands:
aad user get [options] Gets information about the specified user
aad user hibp [options] Allows you to retrieve all accounts that have been pwned with the specified username
aad user list [options] Lists users matching specified criteria
aad user set [options] Updates information about the specified user
Commands groups:
aad user password * 1 command
aad user signin * 1 command
Create an aad user
Creating an AAD user per CLI-Microsoft365 isn't built-in available as m365 aad user create
command, however it can be accomplished using Microsoft Graph. Here an example.
install-module Microsoft.Graph.Users
$tenant="yourtenant"
Connect-MgGraph -Scopes "User.ReadWrite.All","Group.ReadWrite.All"
$params = @{
AccountEnabled = $true
DisplayName = "first name last name"
MailNickname = "firstlast"
UserPrincipalName = "first.last''yourcompany.com''@$($tenant).onmicrosoft.com"
PasswordProfile = @{
ForceChangePasswordNextSignIn = $true
Password = "VMware1!"
}
}
New-MgUser -BodyParameter $params
Id DisplayName Mail UserPrincipalName UserType
-- ----------- ---- ----------------- --------
2e7db79e-b156-4a9a-a0ee-974c3be8314b first name last name first.last''yourcompany.com''@yourtenant.onmicrosoft.com
An AAD user creation task requires readwrite access and has to been specified as scope parameter value in Connect-MgGraph.
The Microsoft Graph New-MgUser
command requires a param Bodyparameter. In the example above a user with UserPrincipalName first.last''yourcompany.com''@yourtenant.sharepoint.com
has been specified. The created user hasn't any license assigned but it is fully functioning for basic Microsoft 365 collaboration activities.
List aad users
filter functionality and listing user properties is already implemented.
m365 aad user list
[
{
"userPrincipalName": "first.last''yourcompany.com''@yourtenant.onmicrosoft.com",
"displayName": "first name last name"
}
]
life-cycle onprem MS sharepoint sites to Sharepoint Online
There are some solutions on the market, most focussing on migration projects.
- Sharegate Desktop
- Kernel Migrator for Sharepoint
- Fly Migration tool from Avepoint
- Quest Migration Solution
- Dockit Migrator from Vyapin software
Research web links
https://github.com/vmware/photon/issues/1094
https://github.com/vmware/photon/issues/1319
https://pnp.github.io/cli-microsoft365
https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-provisioning-sites