Skip to content

Commit b437e54

Browse files
committed
docs: improve permission consideration for azure connection string
1 parent 19d0595 commit b437e54

File tree

1 file changed

+69
-5
lines changed

1 file changed

+69
-5
lines changed

contributing/destinations/azure_servicebus/configuration.md

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ Here's a rough document explaining how AzureServiceBus works and how the destina
66

77
Azure ServiceBus supports both PubSub (Topic & Subscription) and Queue. From the Publisher (Azure's term is Sender) perspective, it doesn't really care whether it's publishing to a Topic or to a Queue. So, from the destination config, all we need is a single "name" field.
88

9-
## Authentication
10-
11-
For authentication, we currently support "connection_string" which generally have access to the full Namespace. So if the end-user wants to ensure Outpost only has access to their desired queue or topic, they should create a new Namespace just for Outpost.
12-
139
## Message
1410

1511
Whether it's publishing to Topic or Queue, the Publisher needs to send an Azure's Message. Here's the full Golang SDK Message struct:
@@ -18,7 +14,7 @@ Whether it's publishing to Topic or Queue, the Publisher needs to send an Azure'
1814
// Message is a message with a body and commonly used properties.
1915
// Properties that are pointers are optional.
2016
type Message struct {
21-
// ApplicationProperties can be used to store custom metadata for a message.
17+
// ApplicationProperties can be used to store custom metadata for a message.
2218
ApplicationProperties map[string]any
2319

2420
// Body corresponds to the first []byte array in the Data section of an AMQP message.
@@ -103,3 +99,71 @@ type Config struct {
10399
```
104100

105101
If we want to support these, we can either add them to Config, such as `Config.TTL`, or we can also add a suffix like `Config.MessageTTL` to specify that these config would apply to the Message.
102+
103+
## Authentication
104+
105+
For authentication, we currently support "connection_string" which by default have access to the full Namespace.
106+
107+
## Creating Topic/Queue-Specific Access Policy
108+
109+
### For a Topic (Send-only access):
110+
111+
Create a Send-only policy for a specific topic
112+
113+
az servicebus topic authorization-rule create \
114+
--resource-group outpost-demo-rg \
115+
--namespace-name outpost-demo-sb-${RANDOM_SUFFIX} \
116+
--topic-name events \
117+
--name SendOnlyPolicy \
118+
--rights Send
119+
120+
Get the Topic-Specific Connection String:
121+
122+
az servicebus topic authorization-rule keys list \
123+
--resource-group outpost-demo-rg \
124+
--namespace-name outpost-demo-sb-${RANDOM_SUFFIX} \
125+
--topic-name events \
126+
--name SendOnlyPolicy \
127+
--query primaryConnectionString \
128+
--output tsv
129+
130+
This returns a connection string that can only send to the events topic:
131+
Endpoint=sb://outpost-demo-sb-a3f2b1.servicebus.windows.net/;SharedAccessKeyName=Send
132+
OnlyPolicy;SharedAccessKey=xyz789...;EntityPath=events
133+
134+
### For Queues (similar approach):
135+
136+
Create a Send-only policy for a specific queue
137+
az servicebus queue authorization-rule create \
138+
--resource-group outpost-demo-rg \
139+
--namespace-name outpost-demo-sb-${RANDOM_SUFFIX} \
140+
--queue-name myqueue \
141+
--name SendOnlyPolicy \
142+
--rights Send
143+
144+
Available Permission Rights:
145+
146+
- Send - Can only send messages
147+
- Listen - Can only receive messages
148+
- Manage - Full control (send, receive, manage)
149+
150+
You can combine multiple rights:
151+
--rights Send Listen # Can both send and receive
152+
153+
Benefits of Entity-Level Access:
154+
155+
1. Security: Limits blast radius if credentials are compromised
156+
2. Principle of Least Privilege: Outpost only needs Send permission
157+
3. Audit Trail: Can track which policy is being used
158+
4. Rotation: Can rotate entity-specific keys without affecting other services
159+
160+
Important Notes:
161+
162+
- Entity-level connection strings include EntityPath parameter
163+
- These policies are scoped to a single topic/queue
164+
- Perfect for production where you want to limit Outpost to only sending to specific
165+
topics
166+
- The connection string format is the same, just with limited scope
167+
168+
This is the recommended approach for production use - give Outpost only the minimum
169+
permissions it needs (Send) and only to the specific topic/queue it should access.

0 commit comments

Comments
 (0)