microsoft azure 虛擬機器與虛擬網路 (2014-4-2 雲端達人班)

72
Microsoft Azure Services for IT Pro VM services and VNet services 朱朱朱 ( 朱朱 ) MVP (Azure) / MCSE (Server Infra) / MCSD (Web Apps) 朱朱朱朱朱朱朱朱

Upload: jeff-chu

Post on 15-Jan-2015

801 views

Category:

Technology


5 download

DESCRIPTION

 

TRANSCRIPT

Microsoft Azure Services for IT ProVM services and VNet services

朱明中 ( 小朱 )MVP (Azure) / MCSE (Server Infra) / MCSD (Web Apps)台灣微軟資深講師

您可以在這堂課學到…• Microsoft Azure 基礎建設服務• Microsoft Azure 虛擬機器 (Virtual Machine

Services)• 部署 Windows / Linux 虛擬機器• 設定磁碟與網路• 指令化管理虛擬機器資源• 虛擬網路服務 (Virtual Network Services)

雲端是不斷變化的環境成

本效

益簡

單管

PaaS

SaaS

平台即服務

軟體即服務

IaaS基礎建設即服務

虛擬化的資料中心

控制力 抽象層次

混合雲

混合雲的基本要素

私有雲本灺雲端建設

傳統機房非虛擬化環境

公有雲 非本地雲端建設

以傳統基礎建設所建置的非虛擬化應用

具有資源池,虛擬化,可擴展且隨需取用的本地化雲端環境。

外部,可擴展且隨需取用的 IT 服務。

混合應用資料與應用程式同時存在於本地端與非本地端

私有雲應用的基本要素

Datacenter TwoDatacenter One

開發 生產

邏輯與標準化

多樣的基礎建設

資源抽象化

委派的能量

標準化服務

給予獨立或共享的資源

Production

Development

Microsoft Azure 跨地區的連結Cloud Enterprise

應用程式層連結與訊息交換

Service Bus

資料同步SQL Azure Data Sync

安全的機器間連結Virtual Network (P2S)

安全的站台間連結Virtual Network (S2S)

應用程式監控與管理System Center

Microsoft Azure 基礎建設服務

Microsoft Azure 基礎建設端服務

儲存的可管理性與可移植性

進階混合雲網路

支援關鍵伺服器應用

保有 IT PRO 的能力

高可用度功能

基礎建設,平台與敏捷服務

Microsoft Azure 虛擬機器服務

虛擬機器服務• Microsoft Azure 的基礎建設服務之一。• 虛擬機器服務 (Virtual Machine Services)• 虛擬網路服務 (Virtual Network Services)

• 以虛擬機器方式供應運算服務。• Windows 平台• Linux 平台

• 可管理的範圍較多。

Why and When: 何時與為何使用虛擬機器服務

Why• 節省建置硬體成本。

• 以最便宜的成本享有與大企業相同的高可用度基礎建設。

• 想要保有自己能管理的彈性。

• 與本地環境的相容度。

• 便於移轉舊型 (Legacy) 應用程式到雲端。

When• 想建置伺服器但又礙於成本問題與人力資源

不足時。

• 想運用雲端來加強服務能力時。

• 想移轉應用程式到雲端,但因為太舊或技術限制導致暫時無法運用雲端服務或網站移轉時。

• 想建置較複雜的開發與實驗環境 (Dev/Test Lab) 時。

隱含的雲端服務

虛擬機器虛擬機器是一個只有單一執行個體的雲端服務角色

虛擬機器執行個體

將作業系統範本寫入儲存區中

Blob Storag

e

Cloud

部署虛擬機器三步驟選擇作業系統範本與虛擬機器大小

選擇要使用什麼方式部署

管理入口網站

>_指令化

(Windows, Linux and Mac)

REST API

由新磁碟啟動 VMWindows Server

Linux

Extra SmallSmallMediumLarge X-Large

目前可用的作業系統範本Windows Server 2008 R2 SP1

Windows Server 2012

Windows Server 2012 R2 Preview

OpenSUSE 12.1

CentOS 6.2

Ubuntu 12.04, 12.10, 13.04

SUSE Linux Enterprise Server SP2, SP3

可支援的應用程式平台

SharePoint 2010SharePoint 2013

SQL Server 2008 R2 WebSQL Server 2008 R2 StandardSQL Server 2008 R2 EnterpriseSQL Server 2012 ExpressSQL Server 2012 WebSQL Server 2012 StandardSQL Server 2012 Enterprise

BizTalk Server 2013Dynamcis GP 2013+Dynamics NAV 2013+Forefront Identity Manager 2010 R2Project Server 2013System Center SuiteTeam Foundation Server

虛擬機器大小

每個永續保存的磁碟最大的大小為 1TB

大小 CPU 核心數

記憶體 頻寬 可掛資料磁碟數

超小 共享 768 MB 5 (Mbps) 1

小 1 1.75 GB 100 (Mbps) 2

中 2 3.5 GB 200 (Mbps) 4

大 4 7 GB 400 (Mbps) 8

超大 8 14 GB 800 (Mbps) 16

A6 4 28 GB 400 (Mbps) 8

A7 8 56 GB 800 (Mbps) 16

60

45

30

15

真正的雲端經濟學,以分計費法用幾分鐘就算幾分鐘。

$虛擬機器

虛擬機器計費模式•標準虛擬機器• 只有作業系統環境,其他的由系統管理人員安

裝與設定。

• 以標準虛擬機器方式計費。

• 在虛擬機器上所安裝的軟體的授權由系統管理員負責。

•例如安裝 Team Foundation Server 時,需先取得正版的 Team Foundation Server

授權。

•應用型虛擬機器• SQL Server

• BizTalk Server

• 評估版軟體

• 價格內含授權費用,不需額外付費。

• 預覽版軟體計費方式與標準虛擬機器相同。

•Windows Server 2012 R2 Preview

• Visual Studio Ultimate 2013 Preview

• SQL Server 2014 Preview

使用虛擬機器的注意事項• 虛擬機器以分計費。• 停止虛擬機器後即不計費,不需要刪除。• 作業系統與資料磁碟所佔用的儲存區空間仍要計費。• 再次啟動時其 IP 位置以及伺服器位置會重新分配。

• 若沒有需要遠端連線的必要時,建議先刪除。• 刪除遠端連線通訊埠以防止外界的攻擊。• 需要連線時再設定即可。

demo

部署 Windows Server 虛擬機器

demo

部署 Linux 虛擬機器 (從範本 )

使用 DEPOT 建立由社群提供的 VM範本• VM DEPOT 是 Microsoft Azure 特別為 Linux 社群提供的作業系統

範本交流工具。 • 內容由社群提供,亦可自行建置範本後上傳到 VM DEPOT 平台。

• 使用者可瀏覽 VM DEPOT 範本以產生影像。• 隨後即可用影像產生虛擬機器。

http://vmdepot.msopentech.com/List/Index

demo

部署 Linux 虛擬機器 (從 DEPOT)

指令化管理

指令碼管理可做的工作

自動化Query, Manage and Configure Virtual Machines across multiple subscriptions, cloud services and storage accounts.

虛擬網路Completely Configure VNETs from a Script

供應完全設定好的虛擬機器Domain JoinedStorage and Networking Configured

設定訂閱資訊

Use: Get-AzurePublishSettingsFile and Import-AzurePublishSettingsFileTo Import Downloaded Publish Profile (.publishsettings) http://windows.azure.com/download/publishprofile.aspx

Automatically configures Subscription ID, Certificate, Service Endpoint and Subscription Name.

手動設定訂閱資訊

Associate Certificate and Subscription ID$cert = Get-Item cert:\CurrentUser\My\CERTTHUMBPRINTSet-AzureSubscription 'mysub' -Certificate $cert -SubscriptionID $id

訂閱管理

Subscription Settings Persisted C:\Users\user\AppData\Roaming\Windows Azure Powershell

Subscription Example<Subscription name="somesub1"> <SubscriptionId>13d83b03-6d06-4770-943c-3d46766c3a35</SubscriptionId>

<Thumbprint>2AC8112B34CC840A30B9C2716AE840D5DC107510</Thumbprint> <ServiceEndpoint>https://management.core.windows.net/</ServiceEndpoint> </Subscription>

在不同的訂閱帳戶間切換

Multiple Subscription Support Get-AzureSubscription | foreach { Select-AzureSubscription $_.SubscriptionName # Perform Management Operation Against Each Subscription}

設定使用的儲存帳戶

Returns Storage AccountGet-AzureStorageAccount | Select StorageAccountName

Cmdlets like New-AzureQuickVM will use this Account

Sets the Current Storage AccountSet-AzureSubscription 'somesub1' -CurrentStorageAccount 'mystorage‘

產生虛擬機器所需的資訊

Image NameGet-AzureVMImage | select ImageName

Disk NameGet-AzureDisk | select DiskName

Data Center LocationGet-AzureLocation

虛擬機器管理

Quick VM Provisioning ModeSupports VM Creation in a Single Cmdlet

Create Multiple Pre-Defined VMs in a BatchNew-AzureVM -VMs $vm1, $vm2, $vm3

Advanced Provisioning Configuration ModeProvision With: Endpoints, Data DisksConfigure: Cache Settings for OS/Data Disks and Subnet Names

簡易虛擬機器生成First Virtual Machine in a NEW Cloud Service (-Location specified)New-AzureQuickVM -Windows -ServiceName $svc -Name $vm1 -ImageName $wimg -Location $location -Password $pwd

New Virtual Machine in an Existing Cloud Service (no –Location)New-AzureQuickVM -Windows -ServiceName $svc -Name $vm2 -ImageName $wimg -Password $pwd

Creating a Linux Virtual Machine in an Existing Cloud ServiceNew-AzureQuickVM -Linux -ServiceName $svc -Name $vm3 -ImageName $limg -LinuxUser $lu -Password $pwd

於發行時設定虛擬機器• Create Configuration Object with New-AzureVMConfig• Modify with Add-* cmdlets• Add with New-AzureVM

New-AzureVMConfig -Name $vm1 -InstanceSize Medium -ImageName $img | Add-AzureProvisioningConfig -Windows -Password $pwd | Add-AzureDataDisk -CreateNew -DiskLabel 'data' -DiskSizeInGB 10 -LUN 0 | Add-AzureEndpoint -Name 'web' -PublicPort 80 -LocalPort 80 -Protocol tcp | New-AzureVM -ServiceName $newSvc -Location $location

虛擬機器批次產生• Create Multiple Configured VMs and Pass to New-AzureVM

$vm1 = New-AzureVMConfig -Name 'myvm1' -InstanceSize 'Small' -ImageName $img | Add-AzureProvisioningConfig -Windows -Password $pwd

$vm2 = New-AzureVMConfig -Name 'myvm1' -InstanceSize 'Small' -ImageName $img | Add-AzureProvisioningConfig -Windows -Password $pwd $vm3 = New-AzureVMConfig -Name 'myvm1' -InstanceSize 'Small' -ImageName $img | Add-AzureProvisioningConfig -Windows -Password $pwd New-AzureVM -CreateService -ServiceName $cloudSvcName -VMs $vm1,$vm2,$vm3 -Location $dc

虛擬機器批次產生 ( 使用陣列 )

• Create Multiple Configured VMs and Pass to New-AzureVM

$vmcount = 5$vms = @()for($i = 0; $i -lt 5; $i++){ $vmn = 'myvm' + $i $vms += New-AzureVMConfig -Name $vmn -InstanceSize 'Small' -ImageName $img | Add-AzureProvisioningConfig -Windows -Password $pwd | Add-AzureDataDisk -CreateNew -DiskLabel 'data' -DiskSizeInGB 10 -LUN 0 | Add-AzureDataDisk -CreateNew -DiskLabel 'logs' -DiskSizeInGB 10 -LUN 1 }

New-AzureVM -ServiceName $cloudSvcName -VMs $vms -Location $dc

共同的設定

NameThe name of the Virtual Machine

InstanceSizeExtraSmall, Small, Medium, Large, ExtraLarge

AvailabilitySetNameThe availability set (used for high availability)

Windows 發行選項Add-AzureProvisioningConfig Options-Windows -Password $pwd-WindowsDomain -Password $pwd -Domain $dom, -JoinDomain $fqdn, -DomainUser $domUser -DomainPassword $domPwd -MachineObjectOU $ou-DisableAutomaticUpdates-NoRDPEndpoint, -TimeZone, Certificates

Linux 發行選項

Add-AzureProvisioningConfig OptionsLinux -LinuxUser $user -Password $pwd -DisableSSH , -NoSSHEndpoint -SSHKeyPairs, -SSHPublicKeys installed from certificates deployed in cloud service

探索虛擬機器Retrieve Cloud Services Get-AzureService

Retrieve Virtual Machines for Service Get-AzureVM -ServiceName $cloudSvcName

Retrieve Status for All VMs in SubsriptionGet-AzureService | foreach { $_ | Get-AzureVM | ft ServiceName, Name, InstanceStatus}

磁碟與網路

網路終端點• 終端點 (Endpoint) 是虛擬機器與外部聯繫的入口。

• 遠端桌面 (TCP Port 3389)

• HTTP (TCP Port 80)

• SQL Server (TCP 1433)

• 終端點是設定在 Windows Azure 的交換器與防火牆上。

• 虛擬機器的作業系統若沒有打開防火牆埠號時仍然無法存取。

• 作業系統若有打開但沒設定終端點時,只有資料中心內的服務與內部網路可存取。

網路終端點的安全性• 終端點與 Windows 防火牆的終端點不同。

• 預設會開啟 Port 3389 ,但對外的埠會以亂數設定。

• 終端點提供了駭客的攻擊面。

• 若沒必要開的終端點應予關閉 (刪除 ) 。

• 例如:遠端桌面不用時應刪除,需要時再打開即可。

demo

設定網路終端點

負載平衡• 當虛擬機器流量大時, Microsoft Azure

會針對有設定相同通訊埠的多台虛擬機器

自動進行負載平衡功能。

• 與 Cloud Service 不同的是, Cloud

Service 會自動處理負載平衡的設

定, VM 則不會。

• 賦與系統管理人員最大的控制權。

PORT 80

負載平衡• 在設定負載平衡之前,先要在其中一台虛擬機器中建立終端點。

• 在相同的虛擬機器雲端服務上,建立另一個新的虛擬機器。

• 設定新虛擬機器的終端點與另一台相同。

demo

設定網路負載平衡

磁碟與影像作業系統影像

• Microsoft• Partner • User

磁碟

• 作業系統磁碟 • 資料磁碟

新虛擬機器的基礎作業系統影像已經過系統整備 / 一般化 /唯讀 利用上傳或是擷取方式建立

供虛擬機器寫入用的磁碟機在虛擬機器建立時,或是以上傳現有VHD 的方式產生。

永續保存的磁碟管理

• C:\ = 作業系統磁碟• D:\ = 不可永久保存的快取資料磁碟• E:\, F:\. G:\ ... 資料磁碟

類型 作業系統磁碟 資料磁碟

主機快取預設值 讀寫快取 無

最大容量 127 GB 1 TB

影像擷取能力 可 不可

熱更新 快取設定需要重新開機

掛載 /卸離與變更快取選項時不需重新開機。

永久保存的磁碟與高強固性

Microsoft Azure Storage

Microsoft Azure Storage ( 災害復原 )

虛擬機器

永久保存的磁碟與高強固性

Microsoft Azure Storage

Microsoft Azure Storage ( 災害復原 )

虛擬機器虛擬機器

Microsoft Azure

您的資料中心

可攜式 VHD 的威力…

Microsoft Azure

您的資料中心

可攜式 VHD 的威力…

您的資料中心

Microsoft Azure 其他服務供應商

可攜式 VHD 的威力…

demo

磁碟管理

虛擬機器儲存作業指令碼作法

Data DisksAdd/Remove data disks at boot or while runningCreate blank or attach existing disks

Modify Cache Settings of OS Disk or Data DiskModifying OS Disk while running requires reboot

建立資料磁碟New Virtual Machine Creation with Data DiskNew-AzureVMConfig -Name 'myvm1' -InstanceSize 'Small' -ImageName $img | Add-AzureProvisioningConfig -Windows -Password $pwd | Add-AzureDataDisk -CreateNew -DiskSizeInGB 10 -DiskLabel 'myddisk' -LUN 0 | New-AzureVM -ServiceName $cloudSvcName

Add new Data Disk to existing Virtual MachineGet-AzureVM -ServiceName 'myvm1' | Add-AzureDataDisk -CreateNew -DiskSizeInGB 10 -DiskLabel 'myddisk' -LUN 1 | Update-AzureVM

修改磁碟快取設定Set Host Caching on OS Disk During ProvisioningNew-AzureVMConfig -Name 'myvm1' -InstanceSize 'Small' -ImageName $img | Add-AzureProvisioningConfig -Windows -Password $pwd | Set-AzureOSDisk -HostCaching 'ReadOnly' | New-AzureVM -ServiceDescription $cloudSvcName

Set Host Caching on Existing Data Disk in running VMGet-AzureVM -ServiceName $cloudSvcName -Name 'myvm1' | Set-AzureDataDisk -HostCaching 'ReadWrite' -LUN 0 | Update-AzureVM

設定網路端點• Add Endpoints at CreationNew-AzureVMConfig -Name 'myvm1' -InstanceSize 'Small' -ImageName $img | Add-AzureProvisioningConfig -Windows -Password $pwd | Add-AzureEndpoint -LocalPort 80 -PublicPort 80 -Name http -Protocol tcp | Add-AzureEndpoint -LocalPort 443 -PublicPort 443 -Name https -Protocol tcp | New-AzureVM -ServiceDescription $cloudSvcName

• Modify Endpoints at RuntimeGet-AzureVM -ServiceName $cloudSvcName -Name 'myvm1' Add-AzureProvisioningConfig -Windows -Password $pwd | Add-AzureEndpoint -LocalPort 53 -PublicPort 53 -Name dns -Protocol udp | Remove-AzureEndpoint -Name https | New-AzureVM -ServiceDescription $cloudSvcName

磁碟與影像儲存庫

OS Images

Get-AzureVMImage # Return all Get-AzureVMImage | Where { $_.Category -eq 'Microsoft' } # Return Microsoft Get-AzureVMImage | Where { $_.Category -eq 'User' } # Return CustomGet-AzureVMImage | Where { $_.Category -eq 'Partner' } # Return Partner ImagesGet-AzureVMImage | Where { $_.OS -eq 'Windows' } # Return only Windows OS imagesRemove-AzureVMImage -ImageName 'myimg' -DeleteVHD # Delete image and storageAdd-AzureVMImage -OS 'Windows' -ImageName 'MyWinImage' -MediaLocation 'http://storageaccount/vhds/winimage.vhd' # Add Existing VM Image from Storage

Disks

Get-AzureDisk # Return all Get-AzureDisk | Where { $_.AttachedTo -eq $null } # Return all not attached to a VMGet-AzureDisk | Where { $_.OS -eq $null } # Return only data disks Get-AzureDisk | Where { $_.OS -eq 'Windows' } # Return only Windows OS disksRemove-AzureDisk -DiskName 'mydisk' -DeleteVHD # Delete disk and storageAdd-AzureDisk -OS 'Windows' -DiskName 'MyWinDisk' -MediaLocation 'http://storageaccount/vhds/winosdisk.vhd‘ # Add Existing OS Disk from Storage Add-AzureDisk -DiskName 'MyDataDisk' -MediaLocation 'http://storageaccount/vhds/datadisk.vhd‘# Add Existing Data Disk from Storage

Microsoft, Partner and User

OS Disks or Data Disks

執行中虛擬機器的批次更新Remove RDP and Add New Storage Across all Web Front Ends

Get-AzureVM -ServiceName $svc | Where { $_.Name -match 'wfe' } | foreach { $_ | Remove-AzureEndpoint -Name 'rdp' | Add-AzureDataDisk -CreateNew -DiskSizeInGB 10 -LUN 1 -DiskLabel 'newstorage' | Update-AzureVM}

將虛擬機器抓取為新的影像

Capture Sys-Prepped VM into a new Image (Deletes the Source VM)

Save-AzureVMImage -ServiceName $cloudSvcName -Name 'myvm1' -NewImageName 'Image Name'

Microsoft Azure虛擬網路服務

Microsoft Azure子網路

本地端子網路

提供網路管理員於雲端設定子網路與管理它作為本地端資料中心的延伸的控制能力。

完全控制

複雜情境

擴展能力

Microsoft Azure 虛擬網路網管專用

Microsoft Azure 虛擬網路服務組織間連線 (Site to Site; S2S)適用於企業資料中心的網路與 Microsoft Azure 虛擬網路的 VPN 連線。需要經過測試的 VPN Device (IKEv1) 做為 VPN 入口。

端點間連線 (Point to Site; P2S)適用於各單點 ( 區域辦公室或員工的筆記型電腦 ) 與 Microsoft Azure 虛擬網路的 VPN 連線。用以取代 Microsoft Azure Connect 。由 Microsoft Azure 虛擬網路提供連線用戶端,與 Microsoft Azure Connect 類似,必須要使用連線用戶端啟用 VPN 才可連線到虛擬網路。

demo

虛擬網路

Microsoft Azure 虛擬網路使用情境

混搭公有與私有雲Windows Azure 上的企業級應用程式需要與本地端資源連接。

企業級識別與存取控制以本地端的資源 ( 如本地端的 AD) 管理識別與存取控制能力。

監控與管理於遠端監控與排除 Windows Azure 上執行的資源的問題。

進階連線需求雲端部署需要實體 IP 及跨服務的直接連線。

虛擬網路指令碼操作View and Set Virtual Network ConfigurationGet-AzureVNetConfig | Select -Expand XMLConfigurationSet-AzureVNetConfig -ConfigurationPath 'c:\Network\MyNetCFG.xml'

Start and Stop Virtual Network Gateway Set-AzureVNetGateway -Disconnect -VNetName 'MyVNet' -LocalNetworkSiteName 'MySite'Set-AzureVNetGateway -Connect -VNetName 'MyVNet' -LocalNetworkSiteName 'MySite'

View Virtual Network StatusGet-AzureVNetConnection -VNetName 'MyVNet'

部署虛擬機器到虛擬網路

Virtual Machine SettingsSet Subnet on VM with Set-AzureSubnet

Deployment SettingsSet Virtual Network -VNetName Set DNS Servers - New-AzureDns and -DNSSettings

Virtual Machine SettingsSet Subnet on VM with Set-AzureSubnet

Deployment SettingsSet Virtual Network -VNetName Set DNS Servers - New-AzureDns and -DNSSettings

重點回顧• Microsoft Azure 基礎建設服務• Microsoft Azure 虛擬機器 (Virtual Machine

Services)• 部署 Windows / Linux 虛擬機器• 設定磁碟與網路• 指令化管理虛擬機器資源

Questions?

© 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.