3

I have been trying to setup an ACS namespace to enable access from a PHP integration app. This was an option in the portal but has now been removed, so I'm trying to create the namespace through powershell. As you can see from the commented out lines I have been trying several approaches. The azure environment was setup in the last few weeks.

#Add-AzureRMAccount
Login-AzureRmAccount -SubscriptionId "my-guid" 
#Select-AzureRMSubscription -SubscriptionId "my-guid" | Select-AzureRmSubscription
Get-AzureRmSubscription -SubscriptionId "my-guid" | Select-AzureRmSubscription
New-AzureSBNamespace -Name "myservicebus.servicebus.windows.net" -Location "UK South" -CreateACSNamespace $true -NamespaceType Messaging

I have tried several combinations but I keep getting the same error when I call the New-AzureSBNamespace method which is as follows "No Default subscription has been designated"

enter image description here

EDIT: I can now create the namespace / service bus via power shell but don't seem to have away of creating ACS for it.

Login-AzureRmAccount -SubscriptionId "2a428947-cc0e-4fa5-aef2-a7ad0fe7a26e" 
Get-AzureRmSubscription -SubscriptionId "2a428947-cc0e-4fa5-aef2-a7ad0fe7a26e" | Select-AzureRmSubscription
New-AzureRmServiceBusNamespace -ResourceGroup StevenStone-Shop -NamespaceName my-service-bus -Location UKSouth -SkuName "Basic"

The reason why I am trying to do this is so that I can connect via PHP with a connection as shown below:

"Endpoint=[yourEndpoint];SharedSecretIssuer=[Default Issuer];SharedSecretValue=[Default Key]"

https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-php-how-to-use-queues

Andrew
  • 9,967
  • 10
  • 64
  • 103
  • Updating powershell / azure commands - https://learn.microsoft.com/en-us/powershell/azure/install-azurerm-ps?view=azurermps-4.1.0 New methods - https://learn.microsoft.com/en-us/powershell/module/azurerm.servicebus/?view=azurermps-4.1.0 – Andrew Jul 03 '17 at 19:58

1 Answers1

0

You may need to add -CreateACSNamespace $true to the command to create a new ACS Service Bus namespace.

Add-AzureAccount # this will sign you in
New-AzureSBNamespace -CreateACSNamespace $true -Name 'mytestbusname' -Location 'West US' -NamespaceType 'Messaging'

enter image description here

If it is successful, you will get the connection string in the PowerShell output. If you get connection errors with it and the connection string looks like Endpoint=sb://..., change it to Endpoint=https://....

For more details, please refer to this post.

Aaron Chen
  • 9,835
  • 1
  • 16
  • 28
  • I believe this only works on the old portal and not using the New-AzureRmServiceBusNamespace which is what i have available (licensed through a CSP so we get only the new portal available) – Andrew Jul 04 '17 at 11:02
  • Have you tried to login with `Add-AzureAccount` in ASM mode? – Aaron Chen Jul 05 '17 at 04:15