[Azure][PowerShell][ASM][03]Cloud Service

$mySubscriptionName=“订阅名称"

Select-AzureSubscription -SubscriptionName $mySubscriptionName 

 

$myLocation = "China North" 

$myServiceName = ""   

New-AzureService -Location $myLocation -ServiceName $myServiceName 

 

$myLocation = "China East" 

$myServiceName = ""   

New-AzureService -Location $myLocation -ServiceName $myServiceName  

 

# Get-AzureService | Format-List ServiceName, Label, Location 

# Remove-AzureService -ServiceName $myServiceName -Force -Verbose 

 

 

.  浏览云服务

Get-AzureService | Select-Object -Property ServiceName, Location,`

@{Name='ProdIP';Expression={(Get-AzureDeployment -Slot Production `

-ServiceName $_.ServiceName).VirtualIPs[0].Address}} | Format-Table -AutoSize

 

 

 

If ((Test-AzureName -Name $ServiceName -Service)) {  

    Write-Host "Create Cloud Service ..." $ServiceName  -ForegroundColor Green  

    # New-AzureService -Location $myLocation -ServiceName $ServiceName 

    }Else {Write-Host "The specified DNS name is already taken or invalid. Try another ServiceName" -ForegroundColor Red} 

 

# Cleanup  

# Get-AzureService |Format-List ServiceName, Label, Location 

# Remove-AzureService -ServiceName $ServiceName -Force -Verbose 

 

Get-AzureService | Select-Object -Property ServiceName, Location,`

   @{Name='ProdIP';Expression={(Get-AzureDeployment -Slot Production `

   -ServiceName $_.ServiceName).VirtualIPs[0].Address}} | Format-Table -AutoSize

原文地址:https://www.cnblogs.com/wuzhenzhou/p/5807106.html