Skip to content

Commit d4c97ea

Browse files
authored
[EventGrid] Small README.md updates (#17313)
Endpoint is a URI, let's make the construction explicit in our samples instead of just a plain string so customers starting from these samples don't hit a type error right away.
1 parent 6455481 commit d4c97ea

File tree

1 file changed

+3
-3
lines changed
  • sdk/eventgrid/Azure.Messaging.EventGrid

1 file changed

+3
-3
lines changed

sdk/eventgrid/Azure.Messaging.EventGrid/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ az eventgrid topic key list --name <your-resource-name> --resource-group <your-r
4343
Once you have your access key and topic endpoint, you can create the publisher client as follows:
4444
```C#
4545
EventGridPublisherClient client = new EventGridPublisherClient(
46-
"<endpoint>",
46+
new Uri("<endpoint>"),
4747
new AzureKeyCredential("<access-key>"));
4848
```
4949
You can also create a **Shared Access Signature** to authenticate the client using the same access key. The signature can be generated using the endpoint, access key, and the time at which the signature becomes invalid for authentication. Create the client using the `EventGridSharedAccessSignatureCredential` type:
5050
```C#
5151
string sasToken = EventGridPublisherClient.BuildSharedAccessSignature(
52-
"<endpoint>",
52+
new Uri("<endpoint>"),
5353
DateTimeOffset.UtcNow.AddMinutes(60),
5454
new AzureKeyCredential("<access-key>"));
5555

5656
EventGridPublisherClient client = new EventGridPublisherClient(
57-
"<endpoint>",
57+
new Uri("<endpoint>"),
5858
new EventGridSharedAccessSignatureCredential(sasToken));
5959
```
6060

0 commit comments

Comments
 (0)