2015/08/26

Azure CLI で Azure ARM:これだけ!シリーズ その6


$ azure availset create -g g-TokyoIaaS -l JapanEast -n avset-for-web
info:    Executing command availset create
+ Looking up the availability set "avset-for-web"
+ Creating availability set "avset-for-web"
info:    availset create command OK

$ azure vm create -g g-TokyoIaaS -l JapanEast -y Windows -n web14 -u hogeadmin -p hogepassword -f nic-web14 -z Standard_D1 -r avset-for-web -o storageaccountname -R vhds -d web14.vhd --image-urn MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest
info:    Executing command vm create
+ Looking up the VM "web14"
info:    Using the VM Size "Standard_D1"
info:    The [OS, Data] Disk or image configuration requires storage account
+ Looking up the storage account storageaccountname
+ Looking up the availability set "avset-for-web"
info:    Found an Availability set "avset-for-web"
+ Looking up the NIC "nic-web14"
info:    Found an existing NIC "nic-web14"
info:    Found an IP configuration with virtual network subnet id "/subscriptions/XXX/resourceGroups/g-TokyoIaaS/providers/Microsoft.Network/virtualNetworks/vNet-Tokyo/subnets/subnet-172.16.1" in the NIC "nic-web14"
info:    This is an NIC without publicIP configured
+ Creating VM "web14"
info:    vm create command OK


2015/08/25

Azure CLI で Azure ARM:これだけ!シリーズ その5


$ azure network nic address-pool add -g g-TokyoIaaS -l lb-web -a lbwebAddressPool -n nic-web14
info:    Executing command network nic address-pool add
+ Looking up the network interface "nic-web14"           
+ Looking up the load balancer "lb-web"
+ Updating network interface "nic-web14"
info:    network nic address-pool add command OK


$ azure network lb inbound-nat-rule create -g g-TokyoIaaS -l lb-web -f 50014 -b 3389 -i frontend-Web -n natruleFor-nic-web14
info:    Executing command network lb inbound-nat-rule create
+ Looking up the load balancer "lb-web"
+ Updating load balancer "lb-web"
+ Looking up the load balancer "lb-web"
data:    Id                              : /subscriptions/XXX/resourceGroups/g-TokyoIaaS/providers/Microsoft.Network/loadBalancers/lb-web/inboundNatRules/natruleFor-nic-web14
data:    Type                            : Microsoft.Network/loadBalancers/inboundNatRules
data:    Name                            : natruleFor-nic-web14
data:    Provisioning state              : Succeeded
data:    Protocol                        : Tcp
data:    Frontend port                   : 50014
data:    Backend port                    : 3389
data:    Enable floating IP              : false
data:    Idle timeout in minutes         : 4
data:    Frontend IP configuration       : /subscriptions/XXX/resourceGroups/g-TokyoIaaS/providers/Microsoft.Network/loadBalancers/lb-web/frontendIPConfigurations/frontend-Web
data:    
info:    network lb inbound-nat-rule create command OK

$ azure network nic inbound-nat-rule add -g g-TokyoIaaS -l lb-web -r natruleFor-nic-web14 -n nic-web14
info:    Executing command network nic inbound-nat-rule add
+ Looking up the network interface "nic-web14"          
+ Looking up the load balancer "lb-web"
+ Updating network interface "nic-web14"
info:    network nic inbound-nat-rule add command OK



仮想マシン イメージ(テンプレート)を、異なるリージョンにコピー Azure CLI編

まずは、PowerShell編をどうぞ。
http://taleofazure.blogspot.jp/2014/11/blog-post.html

異なるリージョン間でなくても、Azure Storage Account間でも同様です。
vhdファイルのお引っ越しに使えます。

SRM な Storage Account からARM な Storage Account へのお引っ越しにも使えます。


===
$ azure storage blob copy start -a storageaccount1 -k keyOfStorageAccount1 --source-container vhds --source-blob WS2012R2-Template.vhd --dest-account-name storageaccount2 --dest-account-key keyOfStorageAccount2 --dest-container vhds --dest-blob WS2012R2-Template.vhd


info:    Executing command storage blob copy start
- Start copying blob https://storageaccount1.blob.core.windows.net/vhds/WS2012R2-Template.vhd?xxx
data:    Copy ID                               Status 
data:    ------------------------------------  -------
data:    XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX  success
info:    storage blob copy start command OK
===


# ストレージアカウント、仮想ディスク、仮想Disk

2015/08/18

複数のサブスクリプションから、利用するサブスクリプションを選択 Azure CLI編

■ログオン
> azure login

info: Executing command login
warn: Please note that currently you can login only via Microsoft organizational account or service principal. For instructions on how to set them up, please read http://aka.ms/Dhf67j.
Username: hoge@hoge.com
Password: 

-info: Added subscription Plan XXX
info: Added subscription Plan YYY
info: Added subscription Plan ZZZ
info: Setting subscription "Plan YYY" as default
+
info: login command OK


■ログオンしたアカウントで使えるサブスクリプションの一覧を表示
>azure account list

info:    Executing command account list
data:    Name                                  Id                                    Tenant Id                             Current
data:    ------------------------------------  ------------------------------------  ------------------------------------  -------
data:    Plan XXX                              XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX  XaXaXaXa-XaXa-XaXa-XaXa-XaXaXaXaXaXa  false
data:    Plan YYY                              YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY  YaYaYaYa-YaYa-YaYa-YaYa-YaYaYaYaYaYa  true
data:    Plan ZZZ                              ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ  ZaZaZaZa-ZaZa-ZaZa-ZaZa-ZaZaZaZaZaZa  false
info:    account list command OK


上記で、
Current 列が true
となっているサブスクリプション(Plan YYY)が、現在コンソールで操作対象になっているサブスクリプション。

■操作対象にするサブスクリプションを変更
たとえば、Plan ZZZ に変更する場合、
>azure account set ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ
info: Executing command account set
info: Setting subscription to "Plan ZZZ" with id "ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ".
info: Changes saved
info: account set command OK


# subscription

2015/08/12

今後のデータディスク容量増加に備えて


データディスクで、将来そのドライブ自体の容量を大きくする可能性がある場合は、あらかじめ「記憶域スペース」を展開しておくと便利です。

Azureに限った話では無く、Windows Server OS一般の話です。
https://technet.microsoft.com/ja-jp/library/jj822938.aspx

LinuxならLVMですね。


# Data Disk, 拡張