Skip to content

Commit

Permalink
[EventGrid] Small README.md updates (Azure#17313)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ellismg authored and annelo-msft committed Feb 17, 2021
1 parent c42c658 commit 8ce8f03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sdk/eventgrid/Azure.Messaging.EventGrid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ az eventgrid topic key list --name <your-resource-name> --resource-group <your-r
Once you have your access key and topic endpoint, you can create the publisher client as follows:
```C#
EventGridPublisherClient client = new EventGridPublisherClient(
"<endpoint>",
new Uri("<endpoint>"),
new AzureKeyCredential("<access-key>"));
```
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:
```C#
string sasToken = EventGridPublisherClient.BuildSharedAccessSignature(
"<endpoint>",
new Uri("<endpoint>"),
DateTimeOffset.UtcNow.AddMinutes(60),
new AzureKeyCredential("<access-key>"));

EventGridPublisherClient client = new EventGridPublisherClient(
"<endpoint>",
new Uri("<endpoint>"),
new EventGridSharedAccessSignatureCredential(sasToken));
```

Expand Down

0 comments on commit 8ce8f03

Please sign in to comment.