3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MacにPowerShellをインストールしてOffice365を操作しようとしてみた

Posted at

はじめに

ひょんなことからMacPowerShellを使ってOffice365の操作を試みることがあったのでメモ

過去の記事を探ったところ、できなさそうな雰囲気はある

  • MacにPowerShellをインストールするが・・・
    • ログインはできるようだが、その後には作業ができなかった。との記載有り
  • MacでPowerShell
    • コメントにちなみにOffice365へのPowerShell(Get-MsolUserとか)はまだ、使えないようです。Install-Module -Name AzureADがエラーになりました(´;ω;`)との記載有り

導入編

公式ドキュメントmacOS への PowerShell Core のインストールを参考に、brewPowerSHellをインストールする

$ brew cask install powershell

インストール後、pwshコマンドでPowerShellを起動できるので、公式ドキュメントOffice 365 PowerShell への接続手順 1: 必要なソフトウェアをインストールするを参考に各種モジュールをインストールする。

$ pwsh
PS /Users/UserName>
PS /Users/UserName> Install-Module -Name AzureAD

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure
you want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y

手順 2: Office 365 サブスクリプション用の Azure AD に接続するに従い、Azure ADに接続を試みる

PS /Users/UserName> Connect-AzureAD
Connect-AzureAD: The term 'Connect-AzureAD' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

おや、インストールに失敗する・・・。
どうやら2020/03/11現在MacにインストールできるPowerShell 7.0.0でもOffice365の操作はできない模様。
Get-Credential は実行できるが、それ以外はできない。
はじめにに記載の通り、ログインはできるけどそれ以外の操作はできないんですね・・・。

PS /Users/t.setoguchi> $Cred = Get-Credential

PowerShell credential request
Enter your credentials.
User: admin@sampledayo.com
Password for user admin@sampledayo.com: ************

結論

未だにMacPowerShellではOffice365操作できないということが解った。
今後のMacPowerShellのリリースに期待。

3
3
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?