CommunicationIdentityClient Class

Azure Communication Services Identity client.

Inheritance
builtins.object
CommunicationIdentityClient

Constructor

CommunicationIdentityClient(endpoint: str, credential: AsyncTokenCredential, **kwargs)

Parameters

endpoint
str
Required

The endpoint url for Azure Communication Service resource.

credential
<xref:AsyncTokenCredential>
Required

The AsyncTokenCredential we use to authenticate against the service.

Methods

close

Close the :class: ~azure.communication.identity.aio.CommunicationIdentityClient session.

create_user

create a single Communication user

create_user_and_token

create a single Communication user with an identity token. :param scopes:

List of scopes to be added to the token.

delete_user

Triggers revocation event for user and deletes all its data.

from_connection_string

Create CommunicationIdentityClient from a Connection String.

get_token

Generates a new token for an identity.

get_token_for_teams_user

Exchanges an Azure AD access token of a Teams User for a new Communication Identity access token.

revoke_tokens

Schedule revocation of all tokens of an identity.

close

Close the :class: ~azure.communication.identity.aio.CommunicationIdentityClient session.

async close() -> None

create_user

create a single Communication user

async create_user(**kwargs) -> azure.communication.identity._shared.models.CommunicationUserIdentifier

Returns

CommunicationUserIdentifier

Return type

create_user_and_token

create a single Communication user with an identity token. :param scopes:

List of scopes to be added to the token.

async create_user_and_token(scopes: List[Union[str, CommunicationTokenScope]], **kwargs) -> Tuple[CommunicationUserIdentifier, azure.core.credentials.AccessToken]

Returns

A tuple of a CommunicationUserIdentifier and a AccessToken.

Return type

delete_user

Triggers revocation event for user and deletes all its data.

async delete_user(user: azure.communication.identity._shared.models.CommunicationUserIdentifier, **kwargs) -> None

Parameters

user
CommunicationUserIdentifier
Required

Azure Communication User to delete

Returns

None

Return type

from_connection_string

Create CommunicationIdentityClient from a Connection String.

from_connection_string(conn_str: str, **kwargs) -> azure.communication.identity.aio._communication_identity_client_async.CommunicationIdentityClient

Parameters

conn_str
str
Required

A connection string to an Azure Communication Service resource.

conn_str
Required

Returns

Instance of CommunicationIdentityClient.

Return type

get_token

Generates a new token for an identity.

async get_token(user: azure.communication.identity._shared.models.CommunicationUserIdentifier, scopes: List[Union[str, CommunicationTokenScope]], **kwargs) -> azure.core.credentials.AccessToken

Parameters

user
CommunicationUserIdentifier
Required

Azure Communication User

scopes
list[str or CommunicationTokenScope]
Required

List of scopes to be added to the token.

Returns

AccessToken

Return type

get_token_for_teams_user

Exchanges an Azure AD access token of a Teams User for a new Communication Identity access token.

async get_token_for_teams_user(aad_token: str, client_id: str, user_object_id: str, **kwargs) -> azure.core.credentials.AccessToken

Parameters

aad_token
str
Required

an Azure AD access token of a Teams User

client_id
str
Required

a Client ID of an Azure AD application to be verified against the appId claim in the Azure AD access token.

user_object_id
str
Required

an Object ID of an Azure AD user (Teams User) to be verified against the OID claim in the Azure AD access token.

Returns

AccessToken

Return type

revoke_tokens

Schedule revocation of all tokens of an identity.

async revoke_tokens(user: azure.communication.identity._shared.models.CommunicationUserIdentifier, **kwargs) -> None

Parameters

user
CommunicationUserIdentifier
Required

Azure Communication User.

Returns

None

Return type