Registry /
azure / azure-communication-phonenumbers
Install & Compatibility
Where this runs
tested against v1.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.468s · 24.7MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.5s · import 0.420s · 25MB
23MB installed
● package 23MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
PhoneNumbersClient
✓ from azure.communication.phonenumbers import PhoneNumbersClient
✗ from azure.communication import PhoneNumbersClient
Import path includes 'phonenumbers' subpackage.
PhoneNumberCapabilities
✓ from azure.communication.phonenumbers import PhoneNumberCapabilities
✗ from azure.communication.phonenumbers.models import PhoneNumberCapabilities
Capabilities is directly in the top-level module.
Initialize the client and list purchased phone numbers.
import os
from azure.communication.phonenumbers import PhoneNumbersClient
from azure.identity import DefaultAzureCredential
endpoint = os.environ.get('COMMUNICATION_SERVICES_ENDPOINT', '')
credential = DefaultAzureCredential()
client = PhoneNumbersClient(endpoint, credential)
# List purchased phone numbers
purchased = client.list_purchased_phone_numbers()
for pn in purchased:
print(pn.phone_number)
Errors
Common errors & fixes
ImportError: cannot import name 'PhoneNumbersClient' from 'azure.communication'
Incorrect import path; missing 'phonenumbers' subpackage.
fixUse: from azure.communication.phonenumbers import PhoneNumbersClient
AttributeError: 'PhoneNumberCapabilities' object has no attribute 'sms'
Trying to access a capability that was not set; capabilities are optional and may be None.
fixCheck capability attribute for None before use: if cap.sms: ...
Upgrade
Version history
1.4.0latest on PyPI · released Aug 28, 2025
Audit
Dependencies
azure-corerequiredHTTP pipeline and authentication
azure-identityrequiredToken credential for authentication