Skip to content

Commit 7f89cb1

Browse files
authored
[Communication] - Authentication - PhoneNumberAdministrationClient auth using token credential (Azure#13271)
* [phoneNumberAdminstrationClient] adding new constructor for phone number to use Token Credential * [Conflict] taking incoming recordings * [Recording] Update the query to be true * [README] update the examples and changelog * [phoneNumberAdministrationClientWithToken.spec] renmae the test to be more relevant * [recordedClient] using new common function to create endpoint * [recordedClient] removing unused COMMUNICATION_ENDPOINT * [tests.yml] adding the new env vars
1 parent 40b027d commit 7f89cb1

20 files changed

+576
-1191
lines changed

sdk/communication/communication-administration/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
### Added
1515

1616
- `CommunicationIdentityClient` added a constructor that supports `TokenCredential`.
17+
- `PhoneNumberAdministrationClient` added a constructor that supports `TokenCredential`.
1718

1819
## 1.0.0-beta.3 (2020-11-16)
1920

sdk/communication/communication-administration/README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,19 @@ const client = new CommunicationIdentityClient(HOST, credential);
5656
### Using a connection string
5757

5858
```typescript
59-
import { PhoneNumberAdministrationClient } from "@azure/communication-administration";
59+
import { CommunicationIdentityClient } from "@azure/communication-administration";
6060

6161
const connectionString = `endpoint=HOST;accessKey=KEY`;
6262
const client = new CommunicationIdentityClient(connectionString);
6363
```
6464

65-
### Using a `TokenCredential`
65+
### Using Azure Active Directory Authentication
6666

6767
```typescript
6868
import { CommunicationIdentityClient } from "@azure/communication-administration";
69+
import { DefaultAzureCredential } from "@azure/identity";
6970

70-
let credential = new DefaultAzureCredential();
71+
const credential = new DefaultAzureCredential();
7172
const client = new CommunicationIdentityClient(HOST, credential);
7273
```
7374

@@ -134,9 +135,19 @@ await client.deleteUser(user);
134135
#### Creating an instance of PhoneNumberAdministrationClient
135136

136137
```typescript
137-
import { CommunicationIdentityClient } from "@azure/communication-administration";
138+
import { PhoneNumberAdministrationClient } from "@azure/communication-administration";
138139

139-
const client = new CommunicationIdentityClient(CONNECTION_STRING);
140+
const client = new PhoneNumberAdministrationClient(CONNECTION_STRING);
141+
```
142+
143+
#### Creating an instance of PhoneNumberAdministrationClient with Azure Active Directory Authentication
144+
145+
```typescript
146+
import { PhoneNumberAdministrationClient } from "@azure/communication-administration";
147+
import { DefaultAzureCredential } from "@azure/identity";
148+
149+
const credential = new DefaultAzureCredential();
150+
const client = new PhoneNumberAdministrationClient(HOST, credential);
140151
```
141152

142153
#### Getting countries

sdk/communication/communication-administration/karma.conf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ module.exports = function(config) {
6060
"TEST_MODE",
6161
"COMMUNICATION_CONNECTION_STRING",
6262
"INCLUDE_PHONENUMBER_TESTS",
63-
"COMMUNICATION_ENDPOINT",
6463
"AZURE_CLIENT_ID",
6564
"AZURE_CLIENT_SECRET",
66-
"AZURE_TENANT_ID"
65+
"AZURE_TENANT_ID",
66+
"AZURE_PHONE_NUMBER"
6767
],
6868

6969
// test results reporter to use

sdk/communication/communication-administration/recordings/browsers/phonenumberadministrationclientwithtoken_playbacklive/recording_successfully_gets_phoneplangroupid.json

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/communication-administration/recordings/node/communicationidentityclient_playbacklive/recording_successfully_creates_a_user.js

Lines changed: 25 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/communication-administration/recordings/node/communicationidentityclient_playbacklive/recording_successfully_deletes_a_user.js

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/communication-administration/recordings/node/communicationidentityclient_playbacklive/recording_successfully_issues_a_token_for_a_user_multiple_scopes.js

Lines changed: 25 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/communication-administration/recordings/node/communicationidentityclient_playbacklive/recording_successfully_issues_a_token_for_a_user_single_scope.js

Lines changed: 25 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/communication-administration/recordings/node/communicationidentityclient_playbacklive/recording_successfully_revokes_tokens_issued_for_a_user.js

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)