Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EventGrid] Small README.md updates #17313

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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