SlideShare a Scribd company logo
最近の PowerShell のお話
System Center User Group Japan 第17回 勉強会 (2017.10.14)
Kazuki Takai
自己紹介
 高井 一輝 (Takai Kazuki)
 某ISP勤務
 クラウドサービスの開発、設計、設備維持
 Windows Server / System Center / Linux / etc…
 Microsoft MVP - Cloud and Datacenter Management
 System Center User Group Japan (SCUGJ)
 Twitter : @zhuky7 / Facebook : kazuki.takai
 Blog : http://operationslab.wordpress.com/
内容とセッションのゴール
 最近の PowerShell についてお話します
 ここ1年くらい
 Deep Dive ではありません
 Deep な話はぜひ個別に(懇親会などで)
 最近の動向についてなんとなく把握いただければ幸いです
Agenda
 PowerShell 6.0
 PowerShell Core
 PowerShell Remoting
 DSC Core
 Azure Cloud Shell
 DSC Resource Kit
 PowerShell 2.0 Deprication
はじめる前に
 本資料の内容は個人的な検証結果に基づきます
 2017/10/01 – 2017/10/14 頃の結果です
 所属する会社や組織、マイクロソフト社の公式な見解を記載するものではありま
せん
 表記や内容に誤りがあるなど、お気づきの点があれば、facebook 等でご連絡
いただけると幸いです
 今後のリリースで機能や動作が変更、削除される可能性があります
 ほとんど文字(とコマンド)です – ご了承ください
ここ1年くらいの出来事 振り返り
 2016/08 – PowerShell ♥ Open Source / Linux
 PowerShell Core v6.0.0-alpha.8 release
 2016/11 – PowerShell 10th Anniversary
 2017/01 – WMF 5.1 Release
 2017/05 – VS Code PowerShell extension 1.0
 2017/05 – PowerShell Core 6.0 Beta 1 release
 Based on .NET Core 2.0
 2017/09 – PowerShell in Azure Cloud Shell (Public Preview)
PowerShell 6.0
 PowerShell 6.0 は PowerShell Core 6.0 としてリリース予定
 Full .NET Framework 非依存
 マルチプラットフォーム
 WMF とは分離
 PowerShell 5.1 は継続してサポート
 ただし、大きな機能アップデートおよびマイナーなバグ修正は実施しない
 今後の Windows / Windows Server に PowerShell Core がプリインストールされる
かは不明(言及が無い)
Windows PowerShell vs PowerShell Core
 Windows PowerShell
 Edition: Desktop
 Build on .NET Framework (Full CLR)
 Available on Windows
 PowerShell Core
 Edition: Core
 Build on .NET Core 2.0 (Core CLR)
 Available on Windows, Linux, macOS
PowerShell Core 6.0 のインストール
 Windows x64
 GitHub の Release ページから msi ファイルをダウンロードして実行
 https://github.com/PowerShell/PowerShell/releases
 Windows 10 以前の OS へインストールする場合は、Windows 10 Universal C
Runtime を事前にインストール
 https://www.microsoft.com/download/details.aspx?id=50410
 [暫定] Windows Server 2016 の場合、Microsoft Visual C++ 2015 Redistributable
Update 3 のインストールが必要
 Install-PowerShellRemoting.ps1 は(未だ)動かないので注意
PowerShell Core 6.0 のインストール
 Ubuntu 16.04 LTS
 curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
 curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee
/etc/apt/sources.list.d/microsoft.list
 sudo apt update
 sudo apt install -y powershell
 CentOS 7
 curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee
/etc/yum.repos.d/microsoft.repo
 sudo yum install -y powershell
PowerShell Remoting
 2つのトランスポート プロトコルをサポート(していく予定)
 WinRM (HTTP/HTTPS SOAP)
 SSH
PowerShell Remoting Stack
WS-Management
WinRM
SSH
PowerShell Remoting
Protocol
PowerShell Remoting
Protocol
SSH
PowerShell PowerShell cmd.exe / bash
Objects Objects Text
Windows PowerShell 5.1
PowerShell Core 6.0
Demo
PowerShell Remoting over SSH
PSRP over WinRM
 接続先が Linux の場合
 omi および omi-psrp-server パッケージをインストール
 Microsoft リポジトリを設定済みの場合は、apt / yum からインストール可能
 Basic Authentication を使用して接続
 必要に応じて(接続元が Windows の場合)TrustedHosts などを設定
 接続先が Windows の場合
 Basic 認証を許可するよう Service を設定
 Basic 認証のため、ローカルアカウントのみ利用可能
 追加で、ntlm-omi などを設定すると NTML でも接続できる(らしい)
PSRP over SSH
 接続先が Linux の場合
 sshd のサブシステムとして powershell を登録
 sudo vi /etc/ssh/sshd_config
 Subsystem powershell /usr/bin/powershell -sshs -NoLogo -NoProfile
 接続先が Windows の場合
 Win32 OpenSSH をインストールし sshd をサービスとして起動
 https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH
 sshd のサブシステムとして powershell を登録
 Subsystem powershell C:/Program Files/powershell/6.0.0/powershell.exe -sshs -NoLogo -
NoProfile
 C:¥Program Files¥OpenSSH¥ に PATH を通す
Azure Cloud Shell
 Azure Portal から実行(起動・表示)可能なシェル環境
 シェルを実行する Compute リソースを用意しなくても、シェルを利用可能
 ストレージアカウントが必要
 現時点では、Public Preview
 利用可能なシェル
 Bash (Ubuntu 16.04 LTS)
 PowerShell (Windows Server 2016)
Demo
Azure Cloud Shell
PowerShell in Azure Cloud Shell
 PowerShell 版は Windows Server 2016 ベースで動作
 Windows Server 2016 Datacenter / Server Core
 Version 10.0.14393
 Build 14393.1480.amd64fre.rs1_release.170706-2004
 PowerShell 5.1
 Version 5.1.14393.1480
 Desktop Edition
※ 2017/10/14 時点
Azure Cloud Shell を使うには
 Portal 右上のシェルボタンをクリック
 Bash か PowerShell かを選択
 後から切り替え可能
 Bash 使わない場合は、PowerShell で作成したほうが若干お得
 ストレージアカウントを作成するサブスクリプションを選択
 Cloud Shell 環境で使用するストレージ
 待つ
 10分程度かかる場合があるので、気長に待つ
最近の PowerShell のお話
最近の PowerShell のお話
ファイルの永続化
 Azure Cloud Shell の Compute リソースは適宜リサイクルされる
 永続化ストレージ領域(CloudDrive)が自動的にマウントされる
 永続化が必要なファイルは CloudDrive へ配置
 Cloud Shell 上でユーザーがインストールしたモジュールは、自動的に CloudDrive
へ保存される
 PowerShell 版の場合、$HOME は永続化されないので注意
Cloud Drive
 実体は、Cloud Shell 利用開始時に作成したストレージアカウント
 ストレージアカウント内に作成されたファイル共有
 $HOME/CloudDrive へ自動マウント
 Y:¥ でもアクセス可能
 Cloud Shell の稼働リージョンと同一リージョンのファイル共有を利用可能
 利用している Cloud Shell のインスタンス稼働リージョンと同一である必要がある
 $env:ACC_LOCATION
 CloudDrive を介して、Azure Cloud Shell 内とファイルのやり取りが可能
Azure Drive
 “Azure:” PSDrive
 Azure リソースを取り扱う PSDrive
 他の PSDrive と同様、Azure リソースへのシームレスなアクセスを提供
 コンテキスト依存で応答が変化
 Resource Group の自動判定
 利用可能な Resource Manager Command の自動判定
利用可能なツール
 Azure Cloud Shell PowerShell 版で利用可能なツール
 PowerShell 5.1
 PowerShell Core 6.0 (beta)
 Azure PowerShell / PowerShellGet / PackageManagement / SQLServer (module)
 .NET 4.6 / Node.js / Python
 vim (with IntelliSense) / nano
 git
 sqlcmd
Azure Cloud Shell 考慮ポイント
 非アクティブなセッションはタイムアウトし、リサイクルされる
 今のところ、タイムアウトは 20 分
 永続化が必要なデータは、CloudDrive へ保存する
 $HOME は永続化されないので、必要なら profile でシンボリックリンクなどを作成する
 永続化ストレージ(CloudDrive)がマウントされないことがある
 Restart する(「Restart Cloud Shell」を実行)
 Restart-Computer / Stop-Computer
DSC Resource Kit
 ここ1年は、1~2か月に1度のペースで更新
 かなり広範囲にカバーされてきた
 とはいえ、足りない機能も多い
 相変わらず experimental module も多い
 Find-Module -Tag DSCResourceKit
 cf. Find-DscResource
PowerShell 2.0 Deprecation
 Windows 10 ver. 1709 では Windows PowerShell 2.0 は非推奨
 https://support.microsoft.com/en-us/help/4034825/features-that-are-removed-
or-deprecated-in-windows-10-fall-creators-up
 非推奨になるだけで、削除されるわけではない
 削除に関するマイルストーンは未定
 自作のスクリプトについては、徐々に移行を
 意図的に PowerShell –version 2 で実行しているもの
 #Requires –Version 2 を書いているもの ※特に注意
#Requires
 スクリプトが動作するバージョンに制限を設けるステートメント
 Specifies the minimum version of Windows PowerShell that the script requires.
Enter a major version number and optional minor version number.
 #Requires -Version 3 とすると、PowerShell 3.0 未満では実行できない
 最小バージョンを指定するもので、特定のバージョンを指定するものではない(本来)
 #Require -Version 2
 PowerShell 2.0 エンジンがインストールされている PowerShell 3 以降のシステムで、
#Requires -Version 2 が指定されたスクリプトを実行すると、自動的に 2.0 エンジンで
実行される
まとめ
 今後は PowerShell Core が主流になる見込み
 とりあえず、使える環境があれば使ってみる
 困ったことがあれば教えてください
 モジュールを書いている人は、動くか確認する
 Azure Cloud Shell 便利!
 ただ、パフォーマンスなど改善の余地は多い
 こちらも、困っていることがあれば教えてください
参考資料
 PowerShell Team Blog
 https://blogs.msdn.microsoft.com/powershell/
 Microsoft Ignite 2017 Video Library
 https://myignite.microsoft.com/videos?q=PowerShell
 GitHub
 https://github.com/PowerShell

More Related Content

PDF
IT Pro のための PowerShell スクリプティング
PPTX
Power shell の基本操作と処理の自動化 v2_20120514
PDF
PowerShell DSC と Linux
PDF
Windows PowerShell 2.0 の基礎知識
PDF
PowerShell 5.0 & Security
PDF
Windows PowerShell によるWindows Server 管理の自動化 v4.0 2014.03.13 更新版
PDF
それでも僕はユニットテストを書きたい - Pester powered by PowerShell
PDF
PowerShell を使用した Hyper-V の管理
IT Pro のための PowerShell スクリプティング
Power shell の基本操作と処理の自動化 v2_20120514
PowerShell DSC と Linux
Windows PowerShell 2.0 の基礎知識
PowerShell 5.0 & Security
Windows PowerShell によるWindows Server 管理の自動化 v4.0 2014.03.13 更新版
それでも僕はユニットテストを書きたい - Pester powered by PowerShell
PowerShell を使用した Hyper-V の管理

What's hot (17)

PDF
Windows PowerShell 5.0 と Windows Server vNext の管理
PPTX
PowerShell の基本操作とリモーティング&v3のご紹介 junichia
PDF
PowerShell 5.0 で広がる運用管理の世界
PDF
Nano Server First Step
PDF
Windows PowerShell 2.0 の基礎知識
PDF
PowerShellを使用したWindows Serverの管理
PDF
Chefで始めるWindows Server構築
PPTX
PowerShell 小技集
PPTX
Chef windows linux環境構築
PPT
PowerShell DSC と連携して監視を効率化してみる
PDF
Windows スクリプトセミナー WMI編 VBScript&WMI
PDF
Chef社内勉強会(第1回)
PDF
仮想化した DC を PowerShell で複製する
PDF
Past and Future of PowerShell
KEY
XPages 開発 Tips 百連発
PPTX
明日から始める Chef 入門 #bpstudy
PDF
PowerShell and Release Management Server
Windows PowerShell 5.0 と Windows Server vNext の管理
PowerShell の基本操作とリモーティング&v3のご紹介 junichia
PowerShell 5.0 で広がる運用管理の世界
Nano Server First Step
Windows PowerShell 2.0 の基礎知識
PowerShellを使用したWindows Serverの管理
Chefで始めるWindows Server構築
PowerShell 小技集
Chef windows linux環境構築
PowerShell DSC と連携して監視を効率化してみる
Windows スクリプトセミナー WMI編 VBScript&WMI
Chef社内勉強会(第1回)
仮想化した DC を PowerShell で複製する
Past and Future of PowerShell
XPages 開発 Tips 百連発
明日から始める Chef 入門 #bpstudy
PowerShell and Release Management Server
Ad

Similar to 最近の PowerShell のお話 (20)

PPTX
Windows Azure PHP Tips
PDF
Recap: PowerShell Core
PDF
はじめてのコンテナーDocker & Windows & Linux
PPTX
Windows Server 2016 Essentials TP4の強化ポイントと PowerShellの使いどころ
PPTX
Dev Containers Customization Short version
PDF
環境構築自動化ツールのご紹介
PDF
オトナのDocker入門
PDF
Cloud OS Tech Day 2014:Windows Azure Pack プライベートクラウドとセルフポータル(仮)
PPTX
Monitoring あれこれ
PDF
Personal Cloud Automation
PDF
まっつんチャレンジ OSC出張編 45分でわかる PHP+Eclipseによるテスト駆動開発環境の構築
PDF
Aeolus Conductorによる複数環境へのデプロイ自動化
PDF
Getting started with Windows Containers
PDF
CloudFoundry 2 on Apache CloudStack 4.2.1
PDF
Gluster fs and_swiftapi_20120429
PDF
TFSを支える技術
PDF
OpenCenterによるOpenStack自動構築
PDF
Version管理 1
PDF
Team Foundation Server入門
PDF
[TL10] Azure IaaS 構築・運用・管理の専門家が語る DevTest Labs ~高速・費用無駄ナシ・簡単管理を実現する開発・テスト環境の構築~
Windows Azure PHP Tips
Recap: PowerShell Core
はじめてのコンテナーDocker & Windows & Linux
Windows Server 2016 Essentials TP4の強化ポイントと PowerShellの使いどころ
Dev Containers Customization Short version
環境構築自動化ツールのご紹介
オトナのDocker入門
Cloud OS Tech Day 2014:Windows Azure Pack プライベートクラウドとセルフポータル(仮)
Monitoring あれこれ
Personal Cloud Automation
まっつんチャレンジ OSC出張編 45分でわかる PHP+Eclipseによるテスト駆動開発環境の構築
Aeolus Conductorによる複数環境へのデプロイ自動化
Getting started with Windows Containers
CloudFoundry 2 on Apache CloudStack 4.2.1
Gluster fs and_swiftapi_20120429
TFSを支える技術
OpenCenterによるOpenStack自動構築
Version管理 1
Team Foundation Server入門
[TL10] Azure IaaS 構築・運用・管理の専門家が語る DevTest Labs ~高速・費用無駄ナシ・簡単管理を実現する開発・テスト環境の構築~
Ad

More from Kazuki Takai (20)

PDF
Azure Arc Automanage Machine Configuration による構成の管理と適用
PDF
Azure Arc Jumpstart - Azure ArcBox を使った Azure Arc 対応 SQL MI 学習環境の構築
PDF
Azure Arc Jumpstart Update - HCIBox Edition
PDF
ArcBox のおさらいと最新情報
PDF
Arc 対応サーバーへの SSH アクセス
PDF
Insight into Azure Active Directory #02 - Azure AD B2B Collaboration New Feat...
PDF
Insight into Azure Active Directory - Azure AD Custom Role & Scope
PDF
最近の PowerShell について
PDF
Windows Server 2022 Datacenter Azure Edition Overview
PDF
Azure Arc 概要
PDF
Introducing Windows Terminal
PDF
Recap: Windows Server 2019 Failover Clustering
PDF
使ってみよう PowerShell
PDF
5分で分かる Windows Server 2019 HCI 超概要
PDF
Application Platform としての Windows Server 2019
PDF
Windows Server 2019 で Container を使ってみる
PDF
Windows とコンテナの話
PDF
DSC 再入門
PDF
Azure Stack の使い道 - 2017年11月版 -
PDF
PowerShell 5.0 JEA (Just Enough Administration) First Step
Azure Arc Automanage Machine Configuration による構成の管理と適用
Azure Arc Jumpstart - Azure ArcBox を使った Azure Arc 対応 SQL MI 学習環境の構築
Azure Arc Jumpstart Update - HCIBox Edition
ArcBox のおさらいと最新情報
Arc 対応サーバーへの SSH アクセス
Insight into Azure Active Directory #02 - Azure AD B2B Collaboration New Feat...
Insight into Azure Active Directory - Azure AD Custom Role & Scope
最近の PowerShell について
Windows Server 2022 Datacenter Azure Edition Overview
Azure Arc 概要
Introducing Windows Terminal
Recap: Windows Server 2019 Failover Clustering
使ってみよう PowerShell
5分で分かる Windows Server 2019 HCI 超概要
Application Platform としての Windows Server 2019
Windows Server 2019 で Container を使ってみる
Windows とコンテナの話
DSC 再入門
Azure Stack の使い道 - 2017年11月版 -
PowerShell 5.0 JEA (Just Enough Administration) First Step

最近の PowerShell のお話

  • 1. 最近の PowerShell のお話 System Center User Group Japan 第17回 勉強会 (2017.10.14) Kazuki Takai
  • 2. 自己紹介  高井 一輝 (Takai Kazuki)  某ISP勤務  クラウドサービスの開発、設計、設備維持  Windows Server / System Center / Linux / etc…  Microsoft MVP - Cloud and Datacenter Management  System Center User Group Japan (SCUGJ)  Twitter : @zhuky7 / Facebook : kazuki.takai  Blog : http://operationslab.wordpress.com/
  • 3. 内容とセッションのゴール  最近の PowerShell についてお話します  ここ1年くらい  Deep Dive ではありません  Deep な話はぜひ個別に(懇親会などで)  最近の動向についてなんとなく把握いただければ幸いです
  • 4. Agenda  PowerShell 6.0  PowerShell Core  PowerShell Remoting  DSC Core  Azure Cloud Shell  DSC Resource Kit  PowerShell 2.0 Deprication
  • 5. はじめる前に  本資料の内容は個人的な検証結果に基づきます  2017/10/01 – 2017/10/14 頃の結果です  所属する会社や組織、マイクロソフト社の公式な見解を記載するものではありま せん  表記や内容に誤りがあるなど、お気づきの点があれば、facebook 等でご連絡 いただけると幸いです  今後のリリースで機能や動作が変更、削除される可能性があります  ほとんど文字(とコマンド)です – ご了承ください
  • 6. ここ1年くらいの出来事 振り返り  2016/08 – PowerShell ♥ Open Source / Linux  PowerShell Core v6.0.0-alpha.8 release  2016/11 – PowerShell 10th Anniversary  2017/01 – WMF 5.1 Release  2017/05 – VS Code PowerShell extension 1.0  2017/05 – PowerShell Core 6.0 Beta 1 release  Based on .NET Core 2.0  2017/09 – PowerShell in Azure Cloud Shell (Public Preview)
  • 7. PowerShell 6.0  PowerShell 6.0 は PowerShell Core 6.0 としてリリース予定  Full .NET Framework 非依存  マルチプラットフォーム  WMF とは分離  PowerShell 5.1 は継続してサポート  ただし、大きな機能アップデートおよびマイナーなバグ修正は実施しない  今後の Windows / Windows Server に PowerShell Core がプリインストールされる かは不明(言及が無い)
  • 8. Windows PowerShell vs PowerShell Core  Windows PowerShell  Edition: Desktop  Build on .NET Framework (Full CLR)  Available on Windows  PowerShell Core  Edition: Core  Build on .NET Core 2.0 (Core CLR)  Available on Windows, Linux, macOS
  • 9. PowerShell Core 6.0 のインストール  Windows x64  GitHub の Release ページから msi ファイルをダウンロードして実行  https://github.com/PowerShell/PowerShell/releases  Windows 10 以前の OS へインストールする場合は、Windows 10 Universal C Runtime を事前にインストール  https://www.microsoft.com/download/details.aspx?id=50410  [暫定] Windows Server 2016 の場合、Microsoft Visual C++ 2015 Redistributable Update 3 のインストールが必要  Install-PowerShellRemoting.ps1 は(未だ)動かないので注意
  • 10. PowerShell Core 6.0 のインストール  Ubuntu 16.04 LTS  curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -  curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list  sudo apt update  sudo apt install -y powershell  CentOS 7  curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo  sudo yum install -y powershell
  • 11. PowerShell Remoting  2つのトランスポート プロトコルをサポート(していく予定)  WinRM (HTTP/HTTPS SOAP)  SSH
  • 12. PowerShell Remoting Stack WS-Management WinRM SSH PowerShell Remoting Protocol PowerShell Remoting Protocol SSH PowerShell PowerShell cmd.exe / bash Objects Objects Text Windows PowerShell 5.1 PowerShell Core 6.0
  • 14. PSRP over WinRM  接続先が Linux の場合  omi および omi-psrp-server パッケージをインストール  Microsoft リポジトリを設定済みの場合は、apt / yum からインストール可能  Basic Authentication を使用して接続  必要に応じて(接続元が Windows の場合)TrustedHosts などを設定  接続先が Windows の場合  Basic 認証を許可するよう Service を設定  Basic 認証のため、ローカルアカウントのみ利用可能  追加で、ntlm-omi などを設定すると NTML でも接続できる(らしい)
  • 15. PSRP over SSH  接続先が Linux の場合  sshd のサブシステムとして powershell を登録  sudo vi /etc/ssh/sshd_config  Subsystem powershell /usr/bin/powershell -sshs -NoLogo -NoProfile  接続先が Windows の場合  Win32 OpenSSH をインストールし sshd をサービスとして起動  https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH  sshd のサブシステムとして powershell を登録  Subsystem powershell C:/Program Files/powershell/6.0.0/powershell.exe -sshs -NoLogo - NoProfile  C:¥Program Files¥OpenSSH¥ に PATH を通す
  • 16. Azure Cloud Shell  Azure Portal から実行(起動・表示)可能なシェル環境  シェルを実行する Compute リソースを用意しなくても、シェルを利用可能  ストレージアカウントが必要  現時点では、Public Preview  利用可能なシェル  Bash (Ubuntu 16.04 LTS)  PowerShell (Windows Server 2016)
  • 18. PowerShell in Azure Cloud Shell  PowerShell 版は Windows Server 2016 ベースで動作  Windows Server 2016 Datacenter / Server Core  Version 10.0.14393  Build 14393.1480.amd64fre.rs1_release.170706-2004  PowerShell 5.1  Version 5.1.14393.1480  Desktop Edition ※ 2017/10/14 時点
  • 19. Azure Cloud Shell を使うには  Portal 右上のシェルボタンをクリック  Bash か PowerShell かを選択  後から切り替え可能  Bash 使わない場合は、PowerShell で作成したほうが若干お得  ストレージアカウントを作成するサブスクリプションを選択  Cloud Shell 環境で使用するストレージ  待つ  10分程度かかる場合があるので、気長に待つ
  • 22. ファイルの永続化  Azure Cloud Shell の Compute リソースは適宜リサイクルされる  永続化ストレージ領域(CloudDrive)が自動的にマウントされる  永続化が必要なファイルは CloudDrive へ配置  Cloud Shell 上でユーザーがインストールしたモジュールは、自動的に CloudDrive へ保存される  PowerShell 版の場合、$HOME は永続化されないので注意
  • 23. Cloud Drive  実体は、Cloud Shell 利用開始時に作成したストレージアカウント  ストレージアカウント内に作成されたファイル共有  $HOME/CloudDrive へ自動マウント  Y:¥ でもアクセス可能  Cloud Shell の稼働リージョンと同一リージョンのファイル共有を利用可能  利用している Cloud Shell のインスタンス稼働リージョンと同一である必要がある  $env:ACC_LOCATION  CloudDrive を介して、Azure Cloud Shell 内とファイルのやり取りが可能
  • 24. Azure Drive  “Azure:” PSDrive  Azure リソースを取り扱う PSDrive  他の PSDrive と同様、Azure リソースへのシームレスなアクセスを提供  コンテキスト依存で応答が変化  Resource Group の自動判定  利用可能な Resource Manager Command の自動判定
  • 25. 利用可能なツール  Azure Cloud Shell PowerShell 版で利用可能なツール  PowerShell 5.1  PowerShell Core 6.0 (beta)  Azure PowerShell / PowerShellGet / PackageManagement / SQLServer (module)  .NET 4.6 / Node.js / Python  vim (with IntelliSense) / nano  git  sqlcmd
  • 26. Azure Cloud Shell 考慮ポイント  非アクティブなセッションはタイムアウトし、リサイクルされる  今のところ、タイムアウトは 20 分  永続化が必要なデータは、CloudDrive へ保存する  $HOME は永続化されないので、必要なら profile でシンボリックリンクなどを作成する  永続化ストレージ(CloudDrive)がマウントされないことがある  Restart する(「Restart Cloud Shell」を実行)  Restart-Computer / Stop-Computer
  • 27. DSC Resource Kit  ここ1年は、1~2か月に1度のペースで更新  かなり広範囲にカバーされてきた  とはいえ、足りない機能も多い  相変わらず experimental module も多い  Find-Module -Tag DSCResourceKit  cf. Find-DscResource
  • 28. PowerShell 2.0 Deprecation  Windows 10 ver. 1709 では Windows PowerShell 2.0 は非推奨  https://support.microsoft.com/en-us/help/4034825/features-that-are-removed- or-deprecated-in-windows-10-fall-creators-up  非推奨になるだけで、削除されるわけではない  削除に関するマイルストーンは未定  自作のスクリプトについては、徐々に移行を  意図的に PowerShell –version 2 で実行しているもの  #Requires –Version 2 を書いているもの ※特に注意
  • 29. #Requires  スクリプトが動作するバージョンに制限を設けるステートメント  Specifies the minimum version of Windows PowerShell that the script requires. Enter a major version number and optional minor version number.  #Requires -Version 3 とすると、PowerShell 3.0 未満では実行できない  最小バージョンを指定するもので、特定のバージョンを指定するものではない(本来)  #Require -Version 2  PowerShell 2.0 エンジンがインストールされている PowerShell 3 以降のシステムで、 #Requires -Version 2 が指定されたスクリプトを実行すると、自動的に 2.0 エンジンで 実行される
  • 30. まとめ  今後は PowerShell Core が主流になる見込み  とりあえず、使える環境があれば使ってみる  困ったことがあれば教えてください  モジュールを書いている人は、動くか確認する  Azure Cloud Shell 便利!  ただ、パフォーマンスなど改善の余地は多い  こちらも、困っていることがあれば教えてください
  • 31. 参考資料  PowerShell Team Blog  https://blogs.msdn.microsoft.com/powershell/  Microsoft Ignite 2017 Video Library  https://myignite.microsoft.com/videos?q=PowerShell  GitHub  https://github.com/PowerShell