0

I am trying to setup auditing for the SQL server in Azure and for the same, I need to send the logs to an Event Hub which is not in the same subscription as the SQL server. I am trying to do add this to the SQL server ARM template, however, I do not know how to get the subscription ID via the subscription Name for the event hub resource.

Thanks for your help in advance.

Akash Masand
  • 1,441
  • 14
  • 30

2 Answers2

1

According to my research, Azure ARM template does not provide the function to get the subscription id by the subscription name. It only provides the function to get details about the subscription for the current deployment. For more details, please refer to https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-resource#subscription. enter image description here

If you want to get the subscription id by the name, you need to use the other tools such as PowerShell, Azure CLI. For example

Connect-AzAccount

 Get-AzSubscription -SubscriptionName "name"
Jim Xu
  • 21,610
  • 2
  • 19
  • 39
0

You'll have to pass in your Resource ID of the Event Hub as a param

/subscriptions/<subscriptionID>/resourceGroups/<RGName>/providers/Microsoft.EventHub/namespaces/<EvenHubName>
Bevan
  • 1,305
  • 1
  • 11
  • 17