01 Run servicebus namespace update command (Windows/macOS/Linux) with the name of the Azure Service Bus namespace that you want to configure as the identifier parameter, to disable public network access to the selected namespace by setting the --public-network-access parameter to Disabled:
az servicebus namespace update
--name tm-project5-namespace
--resource-group cloud-shell-storage-westeurope
--public-network-access Disabled
02 The command output should return the information available for the configured namespace:
{
"createdAt": "2024-08-16T09:06:00.3194946Z",
"disableLocalAuth": false,
"id": "/subscriptions/abcd1234-abcd-1234-abcd-1234abcd1234/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.ServiceBus/namespaces/tm-project5-namespace",
"location": "westeurope",
"metricId": "abcd1234-abcd-1234-abcd-1234abcd1234:tm-project5-namespace",
"minimumTlsVersion": "1.2",
"name": "tm-project5-namespace",
"premiumMessagingPartitions": 0,
"provisioningState": "Succeeded",
"publicNetworkAccess": "Disabled",
"resourceGroup": "cloud-shell-storage-westeurope",
"serviceBusEndpoint": "https://tm-project5-namespace.servicebus.windows.net:443/",
"sku": {
"name": "Standard",
"tier": "Standard"
},
"status": "Active",
"tags": {},
"type": "Microsoft.ServiceBus/Namespaces",
"updatedAt": "2024-08-16T11:12:00.7249203Z",
"zoneRedundant": false
}
03 To allow access from specific, trusted public IP addresses or IP ranges, run servicebus namespace network-rule-set ip-rule add command (Windows/macOS/Linux) to add an IP rule for an individual IPv4 address or IPv4 address range. Replace \<public-ip-address\> with your public IPv4 address or CIDR range:
az servicebus namespace network-rule-set ip-rule add
--namespace-name tm-project5-namespace
--resource-group cloud-shell-storage-westeurope
--ip-rule ip-address=<public-ip-address> action=Allow
04 The command output should return the information available for the configured Service Bus namespace:
{
"defaultAction": "Allow",
"id": "/subscriptions/abcd1234-abcd-1234-abcd-1234abcd1234/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.ServiceBus/namespaces/tm-project5-namespace/networkRuleSets/default",
"ipRules": [
{
"action": "Allow",
"ipMask": "<public-ip-address>"
}
],
"location": "westeurope",
"name": "default",
"publicNetworkAccess": "Disabled",
"resourceGroup": "cloud-shell-storage-westeurope",
"trustedServiceAccessEnabled": false,
"type": "Microsoft.ServiceBus/Namespaces/NetworkRuleSets",
"virtualNetworkRules": []
}
05 Repeat steps no. 1 - 4 for each Azure Service Bus namespace that you want to configure, available in the selected Azure subscription.
06 Repeat steps no. 1 – 5 for each subscription available in your Microsoft Azure cloud account.