先日の PowerShell で Lync Online に接続してみるシリーズの続き。
Lync だけではなく Office 365、Exchange、SharePoint にも接続できる方法がまとめて紹介されていました。
前準備
Windows PowerShell 用 Windows Azure Active Directory モジュール なるものが必要になるっぽです。ダウンロードはたぶんこの辺。
インストールされた Windows PowerShell 用 Windows Azure Active Directory モジュール を管理者として実行しましょう。
Lync のとき同様、認証情報をセットしておきます。
PS C:\WINDOWS\system32> $credential = Get-Credential
ダイアログが表示されるので Office 365 のユーザー名・パスワードを入力します。
Office 365 に接続
PS C:\WINDOWS\system32> Import-Module MsOnline
使えるコマンドを確認。
PS C:\WINDOWS\system32> Get-Module
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add...
Manifest 3.0.0.0 Microsoft.PowerShell.Security {ConvertFrom-Secur...
Manifest 1.0 MSOnline {Add-MsolForeignGr...
PS C:\WINDOWS\system32> Get-Command -Module MSOnline
CommandType Name ModuleName
----------- ---- ----------
Cmdlet Add-MsolForeignGroupToRole MSOnline
Cmdlet Add-MsolGroupMember MSOnline
Cmdlet Add-MsolRoleMember MSOnline
Cmdlet Confirm-MsolDomain MSOnline
Cmdlet Confirm-MsolEmailVerifiedDomain MSOnline
Cmdlet Connect-MsolService MSOnline
Cmdlet Convert-MsolDomainToFederated MSOnline
Cmdlet Convert-MsolDomainToStandard MSOnline
Cmdlet Convert-MsolFederatedUser MSOnline
Cmdlet Get-MsolAccountSku MSOnline
Cmdlet Get-MsolCompanyInformation MSOnline
Cmdlet Get-MsolContact MSOnline
Cmdlet Get-MsolDomain MSOnline
Cmdlet Get-MsolDomainFederationSettings MSOnline
Cmdlet Get-MsolDomainVerificationDns MSOnline
Cmdlet Get-MsolFederationProperty MSOnline
Cmdlet Get-MsolGroup MSOnline
Cmdlet Get-MsolGroupMember MSOnline
Cmdlet Get-MsolPartnerContract MSOnline
Cmdlet Get-MsolPartnerInformation MSOnline
Cmdlet Get-MsolPasswordPolicy MSOnline
Cmdlet Get-MsolRole MSOnline
Cmdlet Get-MsolRoleMember MSOnline
Cmdlet Get-MsolServicePrincipal MSOnline
Cmdlet Get-MsolServicePrincipalCredential MSOnline
Cmdlet Get-MsolSubscription MSOnline
Cmdlet Get-MsolUser MSOnline
Cmdlet Get-MsolUserByStrongAuthentication MSOnline
Cmdlet Get-MsolUserRole MSOnline
Cmdlet New-MsolDomain MSOnline
Cmdlet New-MsolFederatedDomain MSOnline
Cmdlet New-MsolGroup MSOnline
Cmdlet New-MsolLicenseOptions MSOnline
Cmdlet New-MsolServicePrincipal MSOnline
Cmdlet New-MsolServicePrincipalAddresses MSOnline
Cmdlet New-MsolServicePrincipalCredential MSOnline
Cmdlet New-MsolUser MSOnline
Cmdlet New-MsolWellKnownGroup MSOnline
Cmdlet Redo-MsolProvisionContact MSOnline
Cmdlet Redo-MsolProvisionGroup MSOnline
Cmdlet Redo-MsolProvisionUser MSOnline
Cmdlet Remove-MsolApplicationPassword MSOnline
Cmdlet Remove-MsolContact MSOnline
Cmdlet Remove-MsolDomain MSOnline
Cmdlet Remove-MsolFederatedDomain MSOnline
Cmdlet Remove-MsolForeignGroupFromRole MSOnline
Cmdlet Remove-MsolGroup MSOnline
Cmdlet Remove-MsolGroupMember MSOnline
Cmdlet Remove-MsolRoleMember MSOnline
Cmdlet Remove-MsolServicePrincipal MSOnline
Cmdlet Remove-MsolServicePrincipalCredential MSOnline
Cmdlet Remove-MsolUser MSOnline
Cmdlet Reset-MsolStrongAuthenticationMethodByUpn MSOnline
Cmdlet Restore-MsolUser MSOnline
Cmdlet Set-MsolADFSContext MSOnline
Cmdlet Set-MsolCompanyContactInformation MSOnline
Cmdlet Set-MsolCompanySettings MSOnline
Cmdlet Set-MsolDirSyncEnabled MSOnline
Cmdlet Set-MsolDomain MSOnline
Cmdlet Set-MsolDomainAuthentication MSOnline
Cmdlet Set-MsolDomainFederationSettings MSOnline
Cmdlet Set-MsolGroup MSOnline
Cmdlet Set-MsolPartnerInformation MSOnline
Cmdlet Set-MsolPasswordPolicy MSOnline
Cmdlet Set-MsolServicePrincipal MSOnline
Cmdlet Set-MsolUser MSOnline
Cmdlet Set-MsolUserLicense MSOnline
Cmdlet Set-MsolUserPassword MSOnline
Cmdlet Set-MsolUserPrincipalName MSOnline
Cmdlet Update-MsolFederatedDomain MSOnline結構多いですね。
何かコマンド叩いてみましょう。
まずは Connect-MsolService で接続。
PS C:\WINDOWS\system32> Connect-MsolService -Credential $credential
Get-MsolDomain で使用しているドメイン一覧を取得してみます。
PS C:\WINDOWS\system32> Get-MsolDomain Name Status Authentication ---- ------ -------------- *****.onmicrosoft.com Verified Managed *****.net Verified Managed
標準の onmicrosoft.com ドメインと自分で設定しているカスタムドメインが取得できていますね。
その他のコマンドについてもこちらで解説されていました。