Skip to content

Commit

Permalink
[azservicebus] Update some of the areas where we mention the DefaultA…
Browse files Browse the repository at this point in the history
…zureCredential (#21819)

DefaultAzureCredential is great for getting started but, ultimately, users are expected to look at other more specific credentials. I've added in some text to the spots in our examples (and migration guide) that mention it, with a pointer to the docs so they can figure out what the right credential type is.

Fixes #21504
  • Loading branch information
richardpark-msft authored Oct 24, 2023
1 parent 7ac3d0a commit 4d58405
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions sdk/messaging/azeventhubs/example_consumerclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var consumerClient *azeventhubs.ConsumerClient
var err error

func ExampleNewConsumerClient() {
// `DefaultAzureCredential` tries several common credential types. For more credential types
// see this link: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#readme-credential-types.
defaultAzureCred, err := azidentity.NewDefaultAzureCredential(nil)

if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions sdk/messaging/azeventhubs/example_producerclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
var producerClient *azeventhubs.ProducerClient

func ExampleNewProducerClient() {
// `DefaultAzureCredential` tries several common credential types. For more credential types
// see this link: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#readme-credential-types.
defaultAzureCred, err := azidentity.NewDefaultAzureCredential(nil)

if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions sdk/messaging/azservicebus/example_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ func ExampleNewClient() {
// NOTE: If you'd like to authenticate using a Service Bus connection string
// look at `NewClientFromConnectionString` instead.

// For more information about the DefaultAzureCredential:
// https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#NewDefaultAzureCredential
// `DefaultAzureCredential` tries several common credential types. For more credential types
// see this link: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#readme-credential-types.
credential, err := azidentity.NewDefaultAzureCredential(nil)

if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions sdk/messaging/azservicebus/migrationguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ In `azservicebus`:
```go
// import "github.com/Azure/azure-sdk-for-go/sdk/azidentity"

// `DefaultAzureCredential` tries several common credential types. For more credential types
// see this link: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#readme-credential-types.
credential, err := azidentity.NewDefaultAzureCredential(nil)
client, err := azservicebus.NewClient("<ex: myservicebus.servicebus.windows.net>", credential, nil)
```
Expand Down

0 comments on commit 4d58405

Please sign in to comment.