Azure powershell cmdlet,用于创建Azure Service总线队列和主题

时间:2013-10-03 10:29:34

标签: powershell azure servicebus azureservicebus

是否有用于创建和管理Azure Service总线队列和主题的Azure powershell cmdlet? 以下链接未提供此信息: http://msdn.microsoft.com/library/windowsazure/jj983731.aspx

微软计划很快发布这个消息吗?

3 个答案:

答案 0 :(得分:3)

目前没有用于Service Bus队列和主题的PowerShell cmdlet。它们确实具有用于创建命名空间和一些ACS实体的Cmdlet,但尚未提供代码消息传递。 Azure跨平台命令行工具具有相同的功能。

您可以监控PowerShell Cmdlet中的内容,甚至可以在GitHub上查看Windows Azure SDK-Tools repo上的预发布位。这是构成PowerShell Cmdlet的代码的公共存储库。

我没有看到关于是否/何时将此功能添加到Cmdlet或CLI工具的公开声明。

答案 1 :(得分:1)

最近添加了一些关于此方案的文档: http://azure.microsoft.com/en-us/documentation/articles/service-bus-powershell-how-to-provision/

摘要是,只有有限数量的PowerShell cmdlet与Service Bus相关。但是,您可以引用NuGet包并使用其中的类型来执行客户端库中可用的任何操作。

答案 2 :(得分:0)

 Save the given below template in json file and execute the given below powershell command 
 ----------------------------------------------------------------
 param(
 [Parameter(Mandatory=$True)]
 [string]
 $resourceGroupName,
 [string]
 $resourceGroupLocation,
 [Parameter(Mandatory=$True)]
 [string]
 $templateFilePath = "C:\ARM-ServiceBus\sb_template.json",
 [string]
 $parametersFilePath = "C:\ARM-ServiceBus\sb_parameters.json"
  )

 #***********************************************************************
 # Script body
 # Execution begins here
 #***********************************************************************
  $ErrorActionPreference = "Stop"
  $subscriptionId ='1234-545-474f-4544-5454454545'

  # sign in
   Write-Host "Logging in...";
   Login-AzureRmAccount;

  # select subscription
  Write-Host "Selecting subscription '$subscriptionId'";
  Select-AzureRmSubscription -SubscriptionID $subscriptionId;

  #Create or check for existing resource group
   $resourceGroup = Get-AzureRmResourceGroup -Name $resourceGroupName -
    ErrorAction SilentlyContinue
  if(!$resourceGroup)
  {
     Write-Host "Resource group '$resourceGroupName' does not exist. To 
     create a new resource group, please enter a location.";
   if(!$resourceGroupLocation) {
        $resourceGroupLocation = Read-Host "resourceGroupLocation";
     }
    Write-Host "Creating resource group '$resourceGroupName' in location 
   '$resourceGroupLocation'";
    New-AzureRmResourceGroup -Name $resourceGroupName -Location 
    $resourceGroupLocation
    }
    else{
       Write-Host "Using existing resource group '$resourceGroupName'";
        }

     # Start the deployment
       Write-Host "Starting deployment...";
       if(Test-Path $parametersFilePath) {
       New-AzureRmResourceGroupDeployment -ResourceGroupName 
        $resourceGroupName -TemplateFile $templateFilePath -
       TemplateParameterFile $parametersFilePath;
     } else {
     New-AzureRmResourceGroupDeployment -ResourceGroupName 
       $resourceGroupName -TemplateFile $templateFilePath;
        }

      --------------Template(sb_template.json)--------------------------

     {
      "$schema": "http://schema.management.azure.com/schemas/2014-04-01-
        preview/deploymentTemplate.json#",
        "contentVersion": "1.0.0.0",
        "parameters": {
             "serviceBusNamespaceName": {
             "type": "string",
             "metadata": {
             "description": "Name of the Service Bus namespace"
              }
            },
             "serviceBusQueueName": {
             "type": "string",
             "metadata": {
             "description": "Name of the Queue"
               }
             },
             "serviceBusApiVersion": {
             "type": "string",
             "defaultValue": "2015-08-01",
             "metadata": {
               "description": "Service Bus ApiVersion used by the template"
                     }
            }
       },
      "variables": {
      "location": "[resourceGroup().location]",
      "sbVersion": "[parameters('serviceBusApiVersion')]",
      "defaultSASKeyName": "RootManageSharedAccessKey",
      "authRuleResourceId": "
        [resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', 
       parameters('serviceBusNamespaceName'), 
       variables('defaultSASKeyName'))]"
     },
   "resources": [{
    "apiVersion": "[variables('sbVersion')]",
    "name": "[parameters('serviceBusNamespaceName')]",
    "type": "Microsoft.ServiceBus/Namespaces",
    "location": "[variables('location')]",
    "kind": "Messaging",
  "sku": {
    "name": "StandardSku",
    "tier": "Standard",
    "capacity": 1
  },
    "resources": [{
        "apiVersion": "[variables('sbVersion')]",
        "name": "[parameters('serviceBusQueueName')]",
        "type": "Queues",
        "dependsOn": [
            "[concat('Microsoft.ServiceBus/namespaces/', parameters('serviceBusNamespaceName'))]"
        ],
        "properties": {
            "path": "[parameters('serviceBusQueueName')]"
        }
    }]
}],
"outputs": {
    "NamespaceConnectionString": {
        "type": "string",
        "value": "[listkeys(variables('authRuleResourceId'), variables('sbVersion')).primaryConnectionString]"
    },
    "SharedAccessPolicyPrimaryKey": {
        "type": "string",
        "value": "[listkeys(variables('authRuleResourceId'), variables('sbVersion')).primaryKey]"
    }
}
}