4
votes

Is there any Azure powershell cmdlets for creating and managing Azure Service bus Queue and Topics? The following link does not provide this: http://msdn.microsoft.com/library/windowsazure/jj983731.aspx

Microsoft is planning to release this soon?

3

3 Answers

3
votes

There currently are not PowerShell cmdlets for Service Bus queues and topics. They do have Cmdlets for creating the namespaces and some of the ACS entities, but not brokered messaging yet. The Azure cross-platform command line tool has the same capabilities.

You can monitor what's in the PowerShell Cmdlets, or even see pre-release bits on Windows Azure SDK-Tools repo on GitHub. This is a public repo of the code that makes up the PowerShell Cmdlets.

I've seen no public announcements about if/when this functionality will be added to the Cmdlets or the CLI tools.

1
votes

Some documentation about this scenario was recently added: http://azure.microsoft.com/en-us/documentation/articles/service-bus-powershell-how-to-provision/

The summary is that there are only a limited number of PowerShell cmdlets that relate to Service Bus. However, you can reference the NuGet packages and use the types there to do anything that is available in the client libraries.

0
votes
 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]"
    }
}
}