This article uses ** CLI for Microsoft 365 ** on a Docker container to create a SharePoint Online (SPO) app catalog site.
-** OS **: macOS Catalina version 10.15.6


Go to any directory and create a Dockerfile.
Dockerfile
FROM node:12.18.3
RUN npm i -g @pnp/cli-microsoft365
VOLUME /usr/src
WORKDIR /usr/src
CMD /bin/bash
Create docker-compose.yml.
docker-compose.yaml
version: '3'
services:
  app:
    build: .
    container_name: m365-cli
    tty: true
    volumes: 
      - ./src:/usr/src
    working_dir: "/usr/src"
Start the container with docker-compose up -d --build.
docker-compose up -d --build
After launching the Docker container, check the container ID with docker ps.
docker ps
CONTAINER ID        IMAGE                COMMAND                  CREATED             STATUS              PORTS               NAMES
db0427614c8f        docker-m365cli_app   "docker-entrypoint.s…"   22 seconds ago      Up 21 seconds                           m365-cli
In the above example, db0427614c8f is the container ID, so use this ID to log in to the container.
Replace the container ID with your own and execute.
docker exec -it db0427614c8f /bin/bash
After logging in to the container, let's launch ** CLI for Microsoft 365 **.
m365 login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code CMPFXKTBD to authenticate.
When you execute the command, the login page and authentication code information will be displayed. Go to the specified URL, send the authentication code, and log in with an account that has SharePoint administration privileges in Microsoft 365.
After logging in, check the connection status. It is OK if the account information used at login is displayed.
m365 status
connectedAs: <Email address of the account used to log in>
Run the following command to create a SharePoint Online app catalog site for your tenant.
m365 spo tenant appcatalog add --url <URL for the tenant's app catalog site> --owner <Email address used to sign in> --timeZone 20 --wait
You can see the command options with m365 spo tenant appcatalog add --help. However, there is no detailed description of the timeZone option. For the timeZone option, refer to the result of executing the following command with PnP of PowerShell.
Install-Module SharePointPnPPowerShellOnline
Get-PnPTimeZoneId
timezone list
Id Description                                        Identifier
-- -----------                                        ----------
 0 None                                               No:ne
 2 GREENWICH MEAN TIME DUBLIN EDINBURGH LISBON LONDON UTC
 3 BRUSSELS COPENHAGEN MADRID PARIS                   UTC+01:00
 4 AMSTERDAM BERLIN BERN ROME STOCKHOLM VIENNA        UTC+01:00
 5 ATHENS BUCHAREST ISTANBUL                          UTC+02:00
 6 BELGRADE BRATISLAVA BUDAPEST LJUBLJANA PRAGUE      UTC+01:00
 7 MINSK                                              UTC+02:00
 8 BRASILIA                                           UTC-03:00
 9 ATLANTIC TIME CANADA                               UTC-04:00
10 EASTERN TIME US AND CANADA                         UTC-05:00
11 CENTRAL TIME US AND CANADA                         UTC-06:00
12 MOUNTAIN TIME US AND CANADA                        UTC-07:00
13 PACIFIC TIME US AND CANADA                         UTC-08:00
14 ALASKA                                             UTC-09:00
15 HAWAII                                             UTC-10:00
16 MIDWAY ISLAND SAMOA                                UTC-11:00
17 AUKLAND WELLINGTON                                 UTC+12:00
17 AUKLAND WELLINGTON                                 UTC+12:00
18 BRISBANE                                           UTC+10:00
19 ADELAIDE                                           UTC+09:30
20 OSAKA SAPPORO TOKYO                                UTC+09:00
21 KUALA LUMPUR SINGAPORE                             UTC+08:00
22 BANGKOK HANOI JAKARTA                              UTC+07:00
23 CHENNAI KOLKATA MUMBAI NEW DELHI                   UTC+05:30
24 ABU DHABI MUSCAT                                   UTC+04:00
25 TEHRAN                                             UTC+03:30
26 BAGHDAD                                            UTC+03:00
27 JERUSALEM                                          UTC+02:00
28 NEWFOUNDLAND AND LABRADOR                          UTC-03:30
29 AZORES                                             UTC-01:00
30 MID ATLANTIC                                       UTC-02:00
31 MONROVIA                                           UTC
32 CAYENNE                                            UTC-03:00
33 GEORGETOWN LA PAZ SAN JUAN                         UTC-04:00
34 INDIANA EAST                                       UTC-05:00
35 BOGOTA LIMA QUITO                                  UTC-05:00
36 SASKATCHEWAN                                       UTC-06:00
37 GUADALAJARA MEXICO CITY MONTERREY                  UTC-06:00
38 ARIZONA                                            UTC-07:00
39 INTERNATIONAL DATE LINE WEST                       UTC-12:00
40 FIJI ISLANDS MARSHALL ISLANDS                      UTC+12:00
41 MADAGAN SOLOMON ISLANDS NEW CALENDONIA             UTC+11:00
42 HOBART                                             UTC+10:00
43 GUAM PORT MORESBY                                  UTC+10:00
44 DARWIN                                             UTC+09:30
45 BEIJING CHONGQING HONG KONG SAR URUMQI             UTC+08:00
46 NOVOSIBIRSK                                        UTC+06:00
47 TASHKENT                                           UTC+05:00
48 KABUL                                              UTC+04:30
49 CAIRO                                              UTC+02:00
50 HARARE PRETORIA                                    UTC+02:00
51 MOSCOW STPETERSBURG VOLGOGRAD                      UTC+03:00
53 CAPE VERDE ISLANDS                                 UTC-01:00
54 BAKU                                               UTC+04:00
55 CENTRAL AMERICA                                    UTC-06:00
56 NAIROBI                                            UTC+03:00
57 SARAJEVO SKOPJE WARSAW ZAGREB                      UTC+01:00
58 EKATERINBURG                                       UTC+05:00
59 HELSINKI KYIV RIGA SOFIA TALLINN VILNIUS           UTC+02:00
60 GREENLAND                                          UTC-03:00
61 YANGON RANGOON                                     UTC+06:30
62 KATHMANDU                                          UTC+05:45
63 IRKUTSK                                            UTC+08:00
64 KRASNOYARSK                                        UTC+07:00
65 SANTIAGO                                           UTC-04:00
66 SRI JAYAWARDENEPURA                                UTC+05:30
67 NUKU ALOFA                                         UTC+13:00
68 VLADIVOSTOK                                        UTC+10:00
69 WEST CENTRAL AFRICA                                UTC+01:00
70 YAKUTSK                                            UTC+09:00
71 ASTANA DHAKA                                       UTC+06:00
72 SEOUL                                              UTC+09:00
73 PERTH                                              UTC+08:00
74 KUWAIT RIYADH                                      UTC+03:00
75 TAIPEI                                             UTC+08:00
76 CANBERRA MELBOURNE SYDNEY                          UTC+10:00
77 CHIHUAHUA LA PAZ MAZATLAN                          UTC-07:00
78 TIJUANA BAJA CALFORNIA                             UTC-08:00
79 AMMAN                                              UTC+02:00
80 BEIRUT                                             UTC+02:00
81 MANAUS                                             UTC-04:00
82 TBILISI                                            UTC+04:00
83 WINDHOEK                                           UTC+02:00
84 YEREVAN                                            UTC+04:00
85 BUENOS AIRES                                       UTC-03:00
86 CASABLANCA                                         UTC
87 ISLAMABAD KARACHI                                  UTC+05:00
88 CARACAS                                            UTC-04:30
89 PORT LOUIS                                         UTC+04:00
90 MONTEVIDEO                                         UTC-03:00
91 ASUNCION                                           UTC-04:00
92 PETROPAVLOVSK KACHATSKY                            UTC+12:00
93 COORDINATED UNIVERSAL TIME                         UTC
94 ULAANBAATAR                                        UTC-08:00
After the creation is completed, execute the following command and check the result. The URL of the tenant's app catalog site will be displayed, so let's actually access it and confirm that it was created.
m365 spo tenant appcatalogurl get
        Recommended Posts