{"id":23328,"library":"azure-communication-rooms","title":"Azure Communication Rooms Client Library","description":"Microsoft Azure Communication Rooms client library for Python. Used to manage and participate in virtual rooms (structured communications with role-based access and lifecycle). Current version: 1.2.0, stable release with regular updates aligned with Azure SDK for Python release cadence.","status":"active","version":"1.2.0","language":"python","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/communication/azure-communication-rooms","tags":["azure","communication","rooms","virtual-rooms","microsoft","cloud"],"install":[{"cmd":"pip install azure-communication-rooms","lang":"bash","label":"Install via pip"},{"cmd":"pip install azure-identity azure-communication-rooms","lang":"bash","label":"Install with identity (recommended for auth)"}],"dependencies":[{"reason":"Required for HTTP pipeline and authentication","package":"azure-core","optional":false},{"reason":"Recommended for obtaining credentials (DefaultAzureCredential, etc.)","package":"azure-identity","optional":true}],"imports":[{"note":"Private underscored modules should not be imported directly; use the public API.","wrong":"from azure.communication.rooms._rooms_client import RoomsClient","symbol":"RoomsClient","correct":"from azure.communication.rooms import RoomsClient"},{"note":"RoomParticipant is exposed at package level; the .models submodule is considered private.","wrong":"from azure.communication.rooms.models import RoomParticipant","symbol":"RoomParticipant","correct":"from azure.communication.rooms import RoomParticipant"},{"note":"Use the public package-level export, not private module.","wrong":"from azure.communication.rooms._models import ParticipantRole","symbol":"ParticipantRole","correct":"from azure.communication.rooms import ParticipantRole"}],"quickstart":{"code":"import os\nfrom azure.communication.rooms import RoomsClient, RoomParticipant, ParticipantRole\nfrom azure.identity import DefaultAzureCredential\n\n# Use environment variable AZURE_COMMUNICATION_CONNECTION_STRING for connection string\n# or use DefaultAzureCredential with endpoint.\n# For simplicity, using a connection string (replace with actual).\nendpoint = os.environ.get('AZURE_COMMUNICATION_ENDPOINT', '')\ncredential = DefaultAzureCredential()\n\nrooms_client = RoomsClient(endpoint, credential)\n\n# Create a room\nroom = rooms_client.create_room(\n    valid_from=None,\n    valid_until=None,\n    participants=[\n        RoomParticipant(\n            communication_identifier='8:acs:your-identifier', # replace\n            role=ParticipantRole.PRESENTER\n        )\n    ]\n)\nprint(f'Room created with ID: {room.id}')\n\n# List rooms\nrooms = rooms_client.list_rooms()\nfor r in rooms:\n    print(f'Room ID: {r.id}')\n\n# Update room validity\nupdated = rooms_client.update_room(room_id=room.id, valid_from=None, valid_until=None)\nprint(f'Room updated: {updated.id}')\n\n# Delete room\nrooms_client.delete_room(room_id=room.id)","lang":"python","description":"Authenticate, create a room, list rooms, update, and delete. Replace the identifier and endpoint with your Azure Communication Services resource details."},"warnings":[{"fix":"Use: from azure.communication.rooms import RoomsClient, RoomParticipant, ParticipantRole","message":"Do not import from private submodules (e.g., azure.communication.rooms._models). These are not part of the public API and may break in minor releases. Always import from the top-level package.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure the identifier is a valid Communication Services identifier, typically obtained from `CommunicationIdentityClient`.","message":"The `communication_identifier` parameter in `RoomParticipant` expects a user identifier string (e.g., from Communication Identity). Do not pass raw phone numbers or emails. Use the format like '8:acs:resourceId_userId'.","severity":"gotcha","affected_versions":"all"},{"fix":"Convert to list: `rooms = list(rooms_client.list_rooms())` or use for-loop.","message":"In version 1.0.0, the `list_rooms` method returned a sync iterator. In 1.1.0+, it supports async iteration. Code expecting a list may break if you try to index directly without converting. The items are `RoomModel` objects, not `RoomParticipant`.","severity":"breaking","affected_versions":">=1.1.0"},{"fix":"Pass `valid_from` and `valid_until` as `datetime.datetime` objects in UTC or None.","message":"The `valid_from` and `valid_until` parameters in `create_room` and `update_room` have been deprecated in favor of setting `valid_from` and `valid_until` as datetime properties. Omitting them or passing None is fine, but using `valid_from` and `valid_until` differently may cause issues.","severity":"deprecated","affected_versions":"<=1.2.0"},{"fix":"When removing, pass participants with any role but only identifier matters: `rooms_client.remove_participants(room_id, [RoomParticipant(communication_identifier='8:acs:...', role=ParticipantRole.PRESENTER)])`.","message":"The `add_participants`, `update_participants`, and `remove_participants` methods accept a list of `RoomParticipant` objects. For removal, you only need the `communication_identifier`; the `role` is ignored but must still be a valid enum value (use `ParticipantRole.PRESENTER` as placeholder).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade to latest version: `pip install --upgrade azure-communication-rooms` and ensure import: `from azure.communication.rooms import RoomsClient`","cause":"Using an older version (<1.0.0) or importing from wrong module. The `create_room` method was introduced in the first stable release.","error":"'RoomsClient' object has no attribute 'create_room'"},{"fix":"Upgrade to >=1.0.0 and use correct import: `from azure.communication.rooms import RoomParticipant`","cause":"Importing from a non-existent subpackage or version mismatch. `RoomParticipant` is available from version 1.0.0+ but may be called `ParticipantRole` incorrectly.","error":"AttributeError: module 'azure.communication.rooms' has no attribute 'RoomParticipant'"},{"fix":"Use `ParticipantRole.ATTENDEE`, `ParticipantRole.CONSUMER`, or `ParticipantRole.PRESENTER` (not their string counterparts).","cause":"Passing a string like 'Viewer' or 'Speaker' instead of the `ParticipantRole` enum.","error":"ValueError: Invalid role. Valid roles are: Attendee, Consumer, Presenter"},{"fix":"Generate a valid identifier via `CommunicationIdentityClient.create_user()` or use a known raw ID.","cause":"The `communication_identifier` is malformed or not a valid Communication Services identity. It must start with '8:acs:' followed by the resource ID and user ID.","error":"HttpResponseError: (BadRequest) Participant identifier is not valid."},{"fix":"Install the package: `pip install azure-communication-rooms`. It includes the `azure.communication` namespace.","cause":"Missing base `azure-communication-rooms` package or incorrect installation order.","error":"ModuleNotFoundError: No module named 'azure.communication'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}