Skip to content

Commit ea33034

Browse files
DOC-4990 rounded out Go AMR page
1 parent 5c657ff commit ea33034

File tree

1 file changed

+44
-12
lines changed
  • content/develop/clients/go

1 file changed

+44
-12
lines changed

content/develop/clients/go/amr.md

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ letting `go-redis-entraid` fetch and renew the authentication tokens for you aut
2626

2727
## Install
2828

29+
Install [`go-redis`]({{< relref "/develop/clients/go" >}}) if you
30+
have not already done so.
31+
2932
From a Go module folder, install `go-redis-entraid` with the
3033
following command:
3134

@@ -43,10 +46,10 @@ to create the `StreamingCredentialsProvider` instances for AMR
4346
using the factory functions that `go-redis-entraid` provides.
4447

4548

46-
### `CredentialProvider` for a service principal
49+
### `StreamingCredentialsProvider` for a service principal
4750

48-
Use the `create_from_service_principal()` factory function to create a
49-
`CredentialProvider` that authenticates to AMR using a
51+
Use the `NewConfidentialCredentialsProvider()` factory function to create a
52+
`StreamingCredentialsProvider` that authenticates to AMR using a
5053
service principal (see the
5154
[Microsoft documentation](https://learn.microsoft.com/en-us/entra/identity-platform/app-objects-and-service-principals) to learn more about service principals).
5255

@@ -56,17 +59,41 @@ You will need the following details of your service principal to make the connec
5659
- Client secret
5760
- Tenant ID
5861

59-
The example below shows how to import the required modules and call
60-
`create_from_service_principal()`:
62+
Use an `AuthorityConfiguration` instance to pass the tenant ID.
63+
This type has the following fields:
6164

62-
```python
63-
from redis import Redis
64-
from redis_entraid.cred_provider import *
65+
- `AuthorityType`: This should have one of the values
66+
- `identity.AuthorityTypeDefault` ("default")
67+
- `identity.AuthorityTypeMultiTenant` ("multi-tenant")
68+
- `identity.AuthorityTypeCustom` ("custom")
69+
- `TenantID`: Pass your tenant ID string here, or use "common" for
70+
a multi-tentant application.
71+
- `Authority`: Custom authority URL. This is only required if you
72+
specified `AuthorityTypeCustom` in the `AuthorityType` field.
73+
74+
The example below shows how to import the required modules and call
75+
`NewConfidentialCredentialsProvider()`:
6576

66-
credential_provider = create_from_service_principal(
67-
<CLIENT_ID>,
68-
<CLIENT_SECRET>,
69-
<TENANT_ID>
77+
```go
78+
import (
79+
"github.com/redis-developer/go-redis-entraid/entraid"
80+
"github.com/redis-developer/go-redis-entraid/identity"
81+
...
82+
)
83+
.
84+
.
85+
provider, err := entraid.NewConfidentialCredentialsProvider(
86+
entraid.ConfidentialIdentityProviderOptions{
87+
CredentialsProviderOptions: entraid.CredentialsProviderOptions{
88+
ClientID: "<your-azure-client-id>",
89+
},
90+
CredentialsType: identity.ClientSecretCredentialType,
91+
ClientSecret: "<your-azure-client-secret>",
92+
Authority: identity.AuthorityConfiguration{
93+
AuthorityType: identity.AuthorityTypeDefault,
94+
TenantID: "<your-azure-tenant-id>",
95+
},
96+
}
7097
)
7198
```
7299

@@ -213,3 +240,8 @@ func main() {
213240
log.Println("Connected to Redis!")
214241
}
215242
```
243+
244+
## More information
245+
246+
See the [`go-redis-entraid`](https://github.com/redis/go-redis-entraid)
247+
GitHub repository for full source code and more examples and details.

0 commit comments

Comments
 (0)