AZ-204Chapter 76 of 102Objective 5.1

Azure Communication Services

This chapter covers Azure Communication Services (ACS), a cloud-based platform for adding voice, video, chat, and SMS capabilities to applications. For the AZ-204 exam, this topic appears in approximately 5-10% of questions, focusing on integration and configuration. Understanding ACS is critical for developers building modern, multichannel communication experiences without managing underlying infrastructure. This chapter will explain the core concepts, APIs, SDKs, and best practices you need to know to pass exam questions and implement real-world solutions.

25 min read
Intermediate
Updated May 31, 2026

Azure Communication Services as a Universal Communication Hub

Imagine a large corporate office building with a central switchboard operator. The building houses many different departments (Sales, Support, Engineering, HR), each with their own internal phone systems and protocols. Instead of each department installing separate phone lines and dealing with different carriers, the central switchboard provides a unified interface: any department can request a call to be placed, a message to be sent, or a video conference to be set up. The operator handles the complexity of connecting to external phone networks (PSTN), sending SMS via cellular carriers, or bridging into third-party services like Teams or Zoom. Internally, the operator uses a standard request format (REST APIs) and manages resources like phone numbers and chat threads. When a salesperson wants to call a customer, they tell the operator (make an API call), the operator allocates a temporary phone number from a pool, connects to the PSTN, and bridges the call. The salesperson never needs to know the intricacies of the telephone network. Similarly, Azure Communication Services (ACS) provides a cloud-based switchboard for communication capabilities—voice, video, chat, SMS—via simple APIs, abstracting away the underlying infrastructure and carrier integrations.

How It Actually Works

What is Azure Communication Services?

Azure Communication Services (ACS) is a managed platform that provides REST APIs and client SDKs to integrate real-time communication features into applications. It supports voice and video calling, chat, SMS, and telephony (PSTN) integration. ACS abstracts the complexity of signaling, media processing, and carrier connectivity, allowing developers to focus on user experience. It is built on the same infrastructure as Microsoft Teams, ensuring high quality and reliability.

Why ACS Exists

Before ACS, developers had to either build their own signaling and media servers (using WebRTC, SIP, etc.) or integrate with third-party services like Twilio. Both approaches require significant expertise in telephony, media codecs, NAT traversal (STUN/TURN), and compliance with regulations like E.164 numbering. ACS provides a turnkey solution with global reach, low latency, and built-in security. It also integrates with Azure Active Directory for authentication and Azure Monitor for diagnostics.

How ACS Works Internally

ACS operates as a set of microservices in Azure. When a client application (e.g., a mobile app) initiates a call, it uses the ACS Calling SDK to create a call object. The SDK communicates with ACS signaling servers using a proprietary protocol over WebSockets. These servers handle session management, user presence, and media negotiation. Media (audio/video) flows through Azure Media Processors that transcode and relay streams. For PSTN calls, ACS connects to the Microsoft Phone System, which routes calls to the public telephone network via certified carriers. Chat messages are stored in Azure Storage (as chat threads) and delivered via WebSockets to clients. SMS messages are sent through Azure's SMS gateway, which partners with mobile carriers globally.

Key Components, Values, Defaults, and Timers

Communication Services Resource: The top-level Azure resource (ARM resource type Microsoft.Communication/communicationServices). Must be created in a supported region (e.g., East US, West Europe). Pricing tier: Free (up to 1,000 monthly active users for chat) or Standard.

Phone Numbers: Can be toll-free or geographic (local) numbers. Supported countries: US, Canada, UK, Germany, etc. Default: no phone numbers assigned; you must purchase via Azure portal or API.

Access Tokens: Used for authentication. Issued via REST API with a scope (e.g., chat, voip). Default token expiry: 24 hours. Can be revoked.

Chat Threads: Created via REST API. Max participants per thread: 250. Default message retention: 30 days (configurable).

Calling SDKs: Available for JavaScript, .NET, iOS, Android. Support peer-to-peer and group calls. Max group call participants: 350 (with server-side recording).

SMS: Max message length: 160 characters (single segment) or up to 765 characters (concatenated). Default sender number: must be purchased.

TURN Servers: ACS provides STUN/TURN services for NAT traversal. TURN relay is used when direct peer-to-peer connection fails. Default TURN lifetime: 2 hours.

Event Grid Integration: ACS emits events (e.g., incoming call, SMS received) to Azure Event Grid. Default event retention: 1 day.

Azure Monitor: Metrics (e.g., call duration, SMS delivery rate) and logs are sent to Log Analytics. Default retention: 30 days.

Configuration and Verification Commands

To create an ACS resource using Azure CLI:

az communication create --name MyAcsResource --location global --data-location UnitedStates --resource-group MyResourceGroup

To list phone numbers:

az communication phonenumber list --resource-group MyResourceGroup --communication-service-name MyAcsResource

To issue an access token (via REST API):

POST https://<resource>.communication.azure.com/identities/<id>/token?api-version=2023-04-01
{
  "scopes": ["chat", "voip"]
}

To send an SMS (via REST API):

POST https://<resource>.communication.azure.com/sms?api-version=2023-04-01
{
  "from": "+14251234567",
  "to": ["+14255551234"],
  "message": "Hello from ACS!"
}

How ACS Interacts with Related Technologies

Azure Active Directory: ACS supports managed identities and service principals for server-side authentication. Client-side uses access tokens.

Azure Event Grid: ACS publishes events (call start/end, SMS received) to Event Grid, which can trigger Azure Functions or Logic Apps.

Azure Logic Apps: Connector available to handle SMS or chat messages without writing code.

Azure Functions: Common pattern to process incoming events (e.g., forward SMS to a database).

Microsoft Teams: ACS can be used to build custom Teams extensions (e.g., Teams calling via ACS).

Azure Storage: Chat message history can be exported to Blob Storage or Cosmos DB.

Exam-Relevant Details

Authentication: Always use access tokens for client SDKs. Server-side operations use Azure AD or resource keys.

Chat vs. Calling: Chat uses REST APIs for message history and WebSockets for real-time. Calling uses SDKs for media.

SMS Limitations: Not available in all countries. Must purchase a number with SMS capability. Two-way SMS requires a number with inbound SMS enabled.

Emergency Calling: ACS does not support emergency calling (e.g., 911) by default. Must use a certified provider for emergency services.

Pricing: Free tier includes 1,000 monthly active chat users, 60 minutes of calling (audio/video), and 100 SMS messages. Standard tier charges per minute/message.

SDK Initialization: Always create a CommunicationIdentityClient to issue tokens. The client SDK requires a token to start a call or chat.

TURN Relay: If a client cannot establish a peer-to-peer connection (e.g., symmetric NAT), ACS provides TURN relay at no extra cost within the calling minutes.

Event Grid Filtering: Use event type filters to reduce noise. Common events: Microsoft.Communication.CallStarted, Microsoft.Communication.SMSReceived.

Chat Thread Lifecycle: Created via REST, participants added via SDK. Threads persist until deleted. Messages are stored for 30 days by default.

Call Recording: Available via server-side APIs. Supports mixed audio recording. Must be initiated during the call.

Custom Domains: You can configure custom domains for ACS endpoints (e.g., https://acs.contoso.com) using Azure Front Door or API Management.

Step-by-Step: Integrating Chat into a Web App

1.

Create ACS Resource: In Azure portal, create a Communication Services resource. Note the endpoint and access key.

2.

Create a User and Token: Use the CommunicationIdentityClient to create a new user and issue an access token with chat scope.

3.

Create a Chat Thread: Call the Chat REST API to create a thread. Provide a topic and list of participants.

4.

Initialize Chat Client: In your web app, use the @azure/communication-chat SDK with the endpoint and token to create a ChatClient.

5.

Start Real-Time Updates: Subscribe to chatMessageReceived event via WebSocket to display incoming messages.

6.

Send a Message: Use chatThreadClient.sendMessage({ content: 'Hello!' }). The message is stored and broadcast to all participants.

7.

Clean Up: When done, delete the thread via REST API to free resources.

Walk-Through

1

Provision ACS Resource

Create an Azure Communication Services resource in your subscription. Choose a data location (e.g., United States) that determines where chat messages and call metadata are stored. This creates an endpoint (e.g., https://contoso.communication.azure.com) and an access key. The access key is used for server-side management (e.g., issuing tokens). For production, use managed identities instead of keys.

2

Issue Access Token

Use the `CommunicationIdentityClient` (from `@azure/communication-identity` SDK) to create a new user identity (a unique GUID) and issue an access token with scopes like `chat` or `voip`. The token defaults to 24 hours. For chat, the token must have the `chat` scope. The token is a JWT that the client SDK uses to authenticate.

3

Create Chat Thread

Call the Chat REST API (POST /chat/threads) with a JSON body containing a topic and an array of participants (each with a user ID and display name). The API returns a thread ID. Example: `{ "topic": "Sales Discussion", "participants": [ { "id": { "communicationUserId": "8:acs:..." }, "displayName": "Alice" } ] }`.

4

Initialize Chat Client

In the client application, create a `ChatClient` instance using the ACS endpoint and the access token. Example: `new ChatClient(endpoint, new AzureCommunicationTokenCredential(token))`. This establishes a WebSocket connection to receive real-time events (e.g., new messages, typing indicators).

5

Send and Receive Messages

Use `chatThreadClient.sendMessage({ content: 'Hello' })` to send a message. The message is stored in Azure Storage and broadcast to all thread participants via WebSocket. To receive messages, subscribe to the `chatMessageReceived` event. Messages are retained for 30 days by default; after that, they are deleted unless you configure longer retention.

6

Monitor and Troubleshoot

Use Azure Monitor to track metrics like number of messages sent, active threads, and errors. Enable diagnostic logs to capture API calls and SDK errors. Common issues include expired tokens (refresh before expiry) and network restrictions (ensure WebSocket connectivity). Use the ACS portal dashboard for real-time monitoring.

What This Looks Like on the Job

Enterprise Scenario 1: Customer Support Chat

A large e-commerce company wants to add live chat to its website. They use ACS Chat SDK to create a chat widget. When a customer clicks 'Chat', the web app calls a serverless Azure Function that creates an ACS user and token, then creates a chat thread with the customer and a support agent. The agent uses a custom dashboard built with the ACS Calling SDK (for voice calls if needed). The company integrates ACS with Azure Event Grid to log chat transcripts to Cosmos DB for analytics. They purchase a toll-free number for SMS-based support. Challenges: handling high concurrency (thousands of chats) requires scaling the serverless functions and using ACS's built-in load balancing. Misconfiguration: not setting proper token expiration leads to users being disconnected mid-chat. They set token expiry to 8 hours (matching a work shift) and refresh tokens via a background job.

Enterprise Scenario 2: Telehealth Video Consultations

A healthcare provider builds a telemedicine app using ACS Calling SDK for video calls between doctors and patients. They use the server-side call recording API to record consultations for compliance. They integrate with Azure AD for doctor authentication and issue short-lived tokens (15 minutes) for patients. They ensure HIPAA compliance by enabling data encryption at rest and in transit. Performance considerations: video quality depends on network; ACS automatically adjusts bitrate and resolution. They deploy TURN servers in multiple regions to reduce latency. Common issue: patients behind strict firewalls cannot connect; they enable TURN relay and test with different network conditions. Misconfiguration: not enabling media encryption (SRTP) by default – ACS enforces it, but developers must not disable it.

Enterprise Scenario 3: SMS Marketing and Notifications

A retail chain uses ACS SMS to send order confirmations and promotional messages. They purchase a short code for high-throughput SMS (100 messages per second). They use the SMS REST API to send messages and set up Event Grid to receive delivery receipts. They implement error handling for undelivered messages (e.g., carrier rejection). They also use ACS Chat for customer feedback threads. Scale considerations: SMS has rate limits (default 100 messages per second per number). They spread traffic across multiple numbers. Misconfiguration: not handling concatenated messages correctly – messages over 160 characters are split into segments, and carriers may reorder them. They test with a tool that simulates carrier behavior.

How AZ-204 Actually Tests This

What AZ-204 Tests on ACS

Exam objective 5.1 'Integrate Azure Communication Services' includes: provisioning ACS resources, managing access tokens, implementing chat, voice/video calling, and SMS. Specific sub-objectives: 5.1.1 Provision and manage ACS resources (create, configure, delete). 5.1.2 Implement user authentication (issue tokens, manage identities). 5.1.3 Implement chat (create threads, send/receive messages). 5.1.4 Implement voice and video calling (using Calling SDK). 5.1.5 Implement SMS (send and receive).

Common Wrong Answers and Why

1.

'Use the ACS SDK without an access token for anonymous users.' Wrong: Anonymous users still need a token with voip scope for calling. ACS does not allow unauthenticated access. Candidates think 'anonymous' means no token, but ACS requires a token for every user, even if identity is not tied to a real person.

2.

'Chat messages are stored indefinitely by default.' Wrong: Default retention is 30 days. Candidates confuse with Azure Storage where you can set infinite retention. The exam tests this default value.

3.

'SMS can be sent from any phone number purchased from ACS.' Wrong: Only numbers with SMS capability enabled can send SMS. A toll-free number may not support SMS in all countries. Candidates assume all numbers support SMS.

4.

'The Calling SDK can be used without a server-side token issuer.' Wrong: The SDK requires a token obtained from a server-side CommunicationIdentityClient. Candidates think they can hardcode a token in the client, but tokens expire and must be refreshed.

Specific Numbers and Terms That Appear on the Exam

Default token expiry: 24 hours.

Max chat thread participants: 250.

Max group call participants: 350 (with recording).

SMS max length: 160 characters per segment; up to 765 characters concatenated.

Supported data locations: United States, Europe, Asia Pacific, etc.

Event types: Microsoft.Communication.SMSReceived, Microsoft.Communication.CallStarted.

SDK names: @azure/communication-identity, @azure/communication-chat, @azure/communication-calling.

Edge Cases and Exceptions

Token revocation: You can revoke a token via API, but it may take up to 5 minutes to propagate.

Chat thread deletion: Deleting a thread does not delete messages immediately; they are soft-deleted and purged after 30 days.

Call recording: Only available in certain regions; requires separate API call.

Emergency calls: ACS does not support 911; you must use a third-party service.

SMS delivery receipts: Not guaranteed; rely on carrier feedback.

How to Eliminate Wrong Answers

If an answer mentions 'no authentication needed', it's wrong because ACS always requires tokens.

If an answer says 'chat messages are stored forever', it's wrong; default is 30 days.

If an answer suggests using the REST API for real-time calling, it's wrong; calling requires the SDK for media.

If an answer claims you can send SMS from any ACS phone number, it's wrong; only numbers with SMS capability.

Key Takeaways

ACS requires an Azure Communication Services resource and access tokens for authentication.

Access tokens have a default expiry of 24 hours and must be scoped (chat, voip, etc.).

Chat messages are retained for 30 days by default; configure retention if needed.

SMS messages are limited to 160 characters per segment; longer messages are concatenated.

Calling SDK (not REST API) is required for real-time audio/video.

ACS does not support emergency calling; integrate a third-party provider.

Event Grid integration allows serverless processing of ACS events.

Use managed identities instead of access keys for production server-side operations.

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

Azure Communication Services (ACS)

Native integration with Azure ecosystem (Event Grid, Logic Apps, AD).

Built on Microsoft Teams infrastructure for high-quality video/voice.

Pricing: Free tier available (1,000 MAU chat, 60 min calling).

Supports PSTN calling via Microsoft Phone System.

Chat threads and message history stored in Azure Storage.

Twilio

Third-party service, no native Azure integration.

Own infrastructure for video/voice (Twilio Video).

No free tier; pay-as-you-go with higher per-unit cost.

PSTN calling via carrier network (Twilio Elastic SIP Trunking).

Chat storage via Twilio's own platform or external DB.

Watch Out for These

Mistake

ACS can be used without any Azure subscription.

Correct

ACS requires an active Azure subscription and a Communication Services resource. You cannot use ACS standalone.

Mistake

The same access token works for both chat and calling.

Correct

Tokens are scoped. A token with `chat` scope cannot be used for calling. You must issue separate tokens for each scope or a token with multiple scopes.

Mistake

Chat messages are delivered in real-time without any SDK.

Correct

Real-time delivery requires the Chat SDK and WebSocket connection. REST API only allows sending and retrieving messages, not push notifications.

Mistake

ACS provides built-in support for emergency calls (e.g., 911).

Correct

ACS does not support emergency calling. You must integrate with a third-party emergency services provider.

Mistake

You can use the ACS Calling SDK without a TURN server.

Correct

ACS provides TURN servers automatically. However, if a client cannot establish a peer-to-peer connection, TURN relay is used. You don't need to deploy your own TURN.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

How do I authenticate users in Azure Communication Services?

Use the `CommunicationIdentityClient` to create a user and issue an access token. The token is a JWT with scopes (chat, voip). The client SDK uses this token to authenticate. For server-side operations, use Azure AD or resource keys.

What is the maximum number of participants in a group call?

Up to 350 participants with server-side recording. Without recording, the limit is 100. For peer-to-peer calls, only 2 participants.

Can I send SMS from any ACS phone number?

No, only numbers with SMS capability enabled can send SMS. When purchasing a number, you must select 'SMS' as a capability. Toll-free numbers may not support SMS in all countries.

How long are chat messages stored?

By default, 30 days. You can change this retention policy via the Azure portal or API. After retention, messages are permanently deleted.

What is the difference between ACS and Azure SignalR Service?

ACS is for communication (voice, video, chat, SMS). SignalR is for real-time web functionality (e.g., push notifications, live dashboards). ACS uses SignalR internally for chat, but you cannot use SignalR alone for calling.

Do I need to deploy TURN servers for ACS calling?

No, ACS provides STUN/TURN servers automatically. However, if your clients are behind restrictive firewalls, you may need to configure network settings to allow access to ACS TURN endpoints.

How do I handle token expiration?

Tokens expire after 24 hours by default. You can refresh tokens by calling the `CommunicationIdentityClient.issueToken` method with a new expiry. In client apps, implement a token refresh callback to get a new token before expiry.

Terms Worth Knowing

Ready to put this to the test?

You've just covered Azure Communication Services — now see how well it sticks with free AZ-204 practice questions. Full explanations included, no account needed.

Done with this chapter?