Skip to content

Commit

Permalink
Add ServiceBus Namespace VNet
Browse files Browse the repository at this point in the history
  • Loading branch information
MCKLMT committed Dec 1, 2020
1 parent 3682e37 commit 8d876f7
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 0 deletions.
46 changes: 46 additions & 0 deletions docs/examples/301/servicebus-namespace-vnet/main.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
param serviceBusNamespaceName string
param virtualNetworkName string
param subnetName string
param location string = resourceGroup().location

resource serviceBusNamespace 'Microsoft.ServiceBus/namespaces@2018-01-01-preview' = {
name: serviceBusNamespaceName
location: location
sku: {
name: 'Premium'
tier: 'Premium'
}
properties: {}
}

resource virtualNetwork 'Microsoft.Network/virtualNetworks@2017-09-01' = {
name: virtualNetworkName
location: location
properties: {
addressSpace: {
addressPrefixes: [
'10.0.0.0/23'
]
}
subnets: [
{
name: subnetName
properties: {
addressPrefix: '10.0.0.0/23'
serviceEndpoints: [
{
service: 'Microsoft.ServiceBus'
}
]
}
}
]
}
}

resource namespaceVirtualNetworkRule 'Microsoft.ServiceBus/namespaces/VirtualNetworkRules@2018-01-01-preview' = {
name: '${serviceBusNamespace.name}/${virtualNetwork.name}'
properties: {
virtualNetworkSubnetId: resourceId('Microsoft.Network/virtualNetworks/subnets/', virtualNetwork.name, subnetName)
}
}
71 changes: 71 additions & 0 deletions docs/examples/301/servicebus-namespace-vnet/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"serviceBusNamespaceName": {
"type": "string"
},
"virtualNetworkName": {
"type": "string"
},
"subnetName": {
"type": "string"
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
}
},
"functions": [],
"resources": [
{
"type": "Microsoft.ServiceBus/namespaces",
"apiVersion": "2018-01-01-preview",
"name": "[parameters('serviceBusNamespaceName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Premium",
"tier": "Premium"
},
"properties": {}
},
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2017-09-01",
"name": "[parameters('virtualNetworkName')]",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/23"
]
},
"subnets": [
{
"name": "[parameters('subnetName')]",
"properties": {
"addressPrefix": "10.0.0.0/23",
"serviceEndpoints": [
{
"service": "Microsoft.ServiceBus"
}
]
}
}
]
}
},
{
"type": "Microsoft.ServiceBus/namespaces/virtualnetworkrules",
"apiVersion": "2018-01-01-preview",
"name": "[format('{0}/{1}', parameters('serviceBusNamespaceName'), parameters('virtualNetworkName'))]",
"properties": {
"virtualNetworkSubnetId": "[resourceId('Microsoft.Network/virtualNetworks/subnets/', parameters('virtualNetworkName'), parameters('subnetName'))]"
},
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces', parameters('serviceBusNamespaceName'))]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]"
]
}
]
}

0 comments on commit 8d876f7

Please sign in to comment.