使用适当的方法登录并选择所需的订阅和资源组,然后继续使用SB cmdlet。
powerShell的登录订阅资源组
Write-Host -ForegroundColor Yellow "Login with your Azure Account"
Add-AzureRmAccount
Write-Host -ForegroundColor Yellow "Your available Subscriptions"
Get-AzureRmSubscription | Format-List -Property Name, Id
$subscriptions = @(Get-AzureRmSubscription | Select-Object -ExpandProperty Id)
$flag = $true
while ($flag) {
Write-Host -ForegroundColor Green 'Enter target Subscription Id: ' -NoNewline
$subscriptionId = Read-Host
if ($subscriptions -contains $subscriptionId) {
Select-AzureRmSubscription -SubscriptionId $subscriptionId
Write-Output "yes"
$flag = $false
break
}
elseif ($flag -eq $true) {
Write-Host "Enter valid Subscription Id"
}
}
Write-Host -ForegroundColor Yellow `r`n'Your Available Resource Groups'
Get-AzureRmResourceGroup | Select-Object -ExpandProperty ResourceGroupName
$resourceGroups = @(Get-AzureRmResourceGroup | Select-Object -ExpandProperty ResourceGroupName)
$flag = $true
while ($flag) {
Write-Host -ForegroundColor Green `r`n'Enter target Resource Group name: ' -NoNewline
$resourceGroupName = Read-Host
if ($resourceGroups -contains $resourceGroupName) {
Set-AzureRmResourceGroup -Name $resourceGroupName -Tag @{}
$flag = $false
break
}
elseif ($flag -eq $true) {
Write-Host `r`n"Enter valid Resource Group name"
}
}
Remove-AzureRmServiceBusTopic
你可以看看
here
对于删除订阅,您可以使用
Remove-AzureRmServiceBusSubscription
也有相关的文件
here
注:
Install-Module -Name AzureRM.ServiceBus