{"record":{"id":"e4395b27a5d52e3f","repo":"microsoft/semantic-kernel","slug":"the-azure-openai-text-to-audio-deployment-name-is","errorCode":null,"errorMessage":"The Azure OpenAI text to audio deployment name is required.","messagePattern":"The Azure OpenAI text to audio deployment name is required\\.","errorType":"exception","errorClass":"ServiceInitializationError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/ai/open_ai/services/azure_text_to_audio.py","lineNumber":79,"sourceCode":"                environment variables. (Optional)\n            env_file_encoding: The encoding of the environment settings file. (Optional)\n            credential: The credential to use for authentication. (Optional)\n        \"\"\"\n        try:\n            azure_openai_settings = AzureOpenAISettings(\n                env_file_path=env_file_path,\n                env_file_encoding=env_file_encoding,\n                api_key=api_key,\n                text_to_audio_deployment_name=deployment_name,\n                endpoint=endpoint,\n                base_url=base_url,\n                api_version=api_version,\n                token_endpoint=token_endpoint,\n            )\n        except ValidationError as exc:\n            raise ServiceInitializationError(f\"Invalid settings: {exc}\") from exc\n        if not azure_openai_settings.text_to_audio_deployment_name:\n            raise ServiceInitializationError(\"The Azure OpenAI text to audio deployment name is required.\")\n\n        super().__init__(\n            deployment_name=azure_openai_settings.text_to_audio_deployment_name,\n            endpoint=azure_openai_settings.endpoint,\n            base_url=azure_openai_settings.base_url,\n            api_version=azure_openai_settings.api_version,\n            service_id=service_id,\n            api_key=azure_openai_settings.api_key.get_secret_value() if azure_openai_settings.api_key else None,\n            ad_token=ad_token,\n            ad_token_provider=ad_token_provider,\n            token_endpoint=azure_openai_settings.token_endpoint,\n            default_headers=default_headers,\n            ai_model_type=OpenAIModelTypes.TEXT_TO_AUDIO,\n            client=async_client,\n            credential=credential,\n        )\n\n    @classmethod","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/ai/open_ai/services/azure_text_to_audio.py#L61-L97","documentation":"Raised by AzureTextToAudio.__init__ after settings creation succeeds but text_to_audio_deployment_name is empty or None. This field is sourced from the deployment_name constructor argument or the AZURE_OPENAI_TEXT_TO_AUDIO_DEPLOYMENT_NAME environment variable. The service needs a deployment name to know which TTS model to target.","triggerScenarios":"Constructing AzureTextToAudio without deployment_name= and without AZURE_OPENAI_TEXT_TO_AUDIO_DEPLOYMENT_NAME in the environment or .env file. Endpoint and auth resolved, but the deployment identifier is absent.","commonSituations":"Using a chat or embedding deployment variable instead of the text-to-audio-specific one; TTS deployment created in Azure but env var not configured; .env file missing the text_to_audio line; fresh deployment environment.","solutions":["Pass deployment_name= explicitly: AzureTextToAudio(deployment_name='tts', ...).","Set AZURE_OPENAI_TEXT_TO_AUDIO_DEPLOYMENT_NAME in your environment or .env file.","Verify the deployment exists in Azure Portal and the name matches exactly."],"exampleFix":"# before\nservice = AzureTextToAudio(\n    endpoint='https://myresource.openai.azure.com',\n    api_key='...',\n)\n# after\nservice = AzureTextToAudio(\n    deployment_name='tts',\n    endpoint='https://myresource.openai.azure.com',\n    api_key='...',\n)","handlingStrategy":"validation","validationCode":"import os\n\ndeployment_name = os.environ.get('AZURE_OPENAI_TEXT_TO_AUDIO_DEPLOYMENT_NAME')\nif not deployment_name:\n    raise ValueError(\n        'AZURE_OPENAI_TEXT_TO_AUDIO_DEPLOYMENT_NAME is not set. '\n        'Set it in your environment or .env file, or pass deployment_name= to the constructor.'\n    )","typeGuard":null,"tryCatchPattern":"from semantic_kernel.exceptions.service_exceptions import ServiceInitializationError\n\ntry:\n    service = AzureTextToAudio(\n        deployment_name=os.environ.get('AZURE_OPENAI_TEXT_TO_AUDIO_DEPLOYMENT_NAME'),\n        endpoint='https://myresource.openai.azure.com',\n        api_key='...',\n    )\nexcept ServiceInitializationError as e:\n    if 'text to audio deployment name is required' in str(e):\n        print('Set AZURE_OPENAI_TEXT_TO_AUDIO_DEPLOYMENT_NAME or pass deployment_name=')\n    raise","preventionTips":["Set AZURE_OPENAI_TEXT_TO_AUDIO_DEPLOYMENT_NAME in your environment or .env file.","Always pass deployment_name= explicitly in the constructor.","Verify the deployment name exists in Azure Portal > Resource Management > Deployments.","Use the text-to-audio-specific env var, not a generic one."],"tags":["azure-openai","text-to-audio","deployment-name","env-vars"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}