Automatically Deploy Azure App use PowerShell Command

本文介绍了如何使用Windows PowerShell管理Azure部署,包括添加Azure管理工具快照、创建新主机服务、新建部署、升级部署等操作。

Add "AzureManagementToolsSnapIn" Command Changed:

  1. Windows Azure PowerShell Cmdlets 1.0: PS C:\windows\system32>Add-PSSnapin AzureManagementToolsSnapIn
  2. Windows Azure PowerShell Cmdlets 2.0: PS C:\windows\system32>Add-PSSnapin WAPPSCmdlets

Create New Host Service 

mytodo 

New-Deployment 

Approach1 ( package in local)

PS C:\windows\system32> New-Deployment -serviceName mytodo -subscriptionId xxxxxx-certificate (get-item cert:\CurrentUser\MY\xxxxxxx) -slot staging –package MyTodo.cspkg -configuration ServiceConfiguration.cscfg -label "v1.0" –storageServiceName xxxxxxx


Approach2 (package in blob)

PS C:\windows\system32>  $package= 'http://xxxxxx.blob.core.windows.net/mydeployments/20111227_062844_MyTodo.cspkg'

PS C:\windows\system32> $config='C:\Users\xxxxxx\Documents\Labs\DeployingApplicationsinWindowsAzureVS2010\Source\Ex2-Dep
loyingWithPowerShell\begin\CS\MyTodo\bin\Release\app.publish\ServiceConfiguration.cscfg'

 PS C:\windows\system32>New-Deployment -slot Production -package $package -configuration $config -label "v1.0" -serviceName myservice -SubscriptionId xxxxx -certificate (get-item cert:\CurrentUser\MY\xxxxxxx)  

Upgrading a Deployment Using Windows PowerShell

Get-HostedService -serviceName testmytodo -subscriptionId xxxx-certificate (get-item cert:\CurrentUser\MY\xxxxxxx) | Get-Deployment Production | Set-Deployment -package MyTodo.cspkg -configuration ServiceConfiguration.cscfg -label "v2.1" –storageServiceName psdeployment

NOte: If you were to run the command as described above, the operation runs asynchronously.To show the operation’s progress while the deployment is taking place, you can pipe the output of the command into the Get-OperationStatus cmdlet and specify the WaitToComplete parameter. Add this cmdlet to the end of the command line entered previously making sure that you include the pipeline character ‘|’, as shown below.


Upgrading a Deployment Using Windows PowerShell 2

Get-HostedService testmytodo -subscriptionId xxx -certificate (get-item cert:\CurrentUser\MY\xxxxxxx) |   Get-Deployment production |   Set-Deployment -package MyTodo.cspkg -configuration ServiceConfiguration.cscfg -label "v2.2" –storageServiceName xxxxxx| Get-OperationStatus -WaitToComplete



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值