1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
@description('The base resource name.')
param baseName string = resourceGroup().name
@description('The client OID to grant access to test resources.')
param testApplicationOid string
var apiVersion = '2017-04-01'
var location = resourceGroup().location
var authorizationRuleName_var = '${baseName}/RootManageSharedAccessKey'
var authorizationRuleNameNoManage_var = '${baseName}/NoManage'
var serviceBusDataOwnerRoleId = '/subscriptions/${subscription().subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/090c5cfd-751d-490a-894a-3ce6f1109419'
resource servicebus 'Microsoft.ServiceBus/namespaces@2018-01-01-preview' = {
name: baseName
location: location
sku: {
name: 'Standard'
tier: 'Standard'
}
properties: {
zoneRedundant: false
}
}
resource authorizationRuleName 'Microsoft.ServiceBus/namespaces/AuthorizationRules@2015-08-01' = {
name: authorizationRuleName_var
location: location
properties: {
rights: [
'Listen'
'Manage'
'Send'
]
}
dependsOn: [
servicebus
]
}
resource authorizationRuleNameNoManage 'Microsoft.ServiceBus/namespaces/AuthorizationRules@2015-08-01' = {
name: authorizationRuleNameNoManage_var
location: location
properties: {
rights: [
'Listen'
'Send'
]
}
dependsOn: [
servicebus
]
}
resource dataOwnerRoleId 'Microsoft.Authorization/roleAssignments@2018-01-01-preview' = {
name: guid('dataOwnerRoleId${baseName}')
properties: {
roleDefinitionId: serviceBusDataOwnerRoleId
principalId: testApplicationOid
}
dependsOn: [
servicebus
]
}
resource testQueue 'Microsoft.ServiceBus/namespaces/queues@2017-04-01' = {
parent: servicebus
name: 'testQueue'
properties: {
lockDuration: 'PT5M'
maxSizeInMegabytes: 1024
requiresDuplicateDetection: false
requiresSession: false
defaultMessageTimeToLive: 'P10675199DT2H48M5.4775807S'
deadLetteringOnMessageExpiration: false
duplicateDetectionHistoryTimeWindow: 'PT10M'
maxDeliveryCount: 10
autoDeleteOnIdle: 'P10675199DT2H48M5.4775807S'
enablePartitioning: false
enableExpress: false
}
}
//resource testQueueWithSessions 'Microsoft.ServiceBus/namespaces/queues@2017-04-01' = {
// parent: servicebus
// name: 'testQueueWithSessions'
// properties: {
// lockDuration: 'PT5M'
// maxSizeInMegabytes: 1024
// requiresDuplicateDetection: false
// requiresSession: true
// defaultMessageTimeToLive: 'P10675199DT2H48M5.4775807S'
// deadLetteringOnMessageExpiration: false
// duplicateDetectionHistoryTimeWindow: 'PT10M'
// maxDeliveryCount: 10
// autoDeleteOnIdle: 'P10675199DT2H48M5.4775807S'
// enablePartitioning: false
// enableExpress: false
// }
//}
output SERVICE_BUS_CONNECTION_STR string = listKeys(resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', baseName, 'RootManageSharedAccessKey'), apiVersion).primaryConnectionString
output SERVICE_BUS_QUEUE_NAME string = 'testQueue'
//output QUEUE_NAME_WITH_SESSIONS string = 'testQueueWithSessions'
//output SERVICE_BUS_CONNECTION_STRING_NO_MANAGE string = listKeys(resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', baseName, 'NoManage'), apiVersion).primaryConnectionString
//output SERVICE_BUS_ENDPOINT string = replace(servicebus.properties.serviceBusEndpoint, ':443/', '')
|