Authentication error (401) text to speech

Paul Dambricourt 5 Reputation points
2023-05-03T14:34:58.8833333+00:00

Hi everyone,

I have a 401 error when using text-to-speech API. Here is my code, that worked until today morning. Can someone help ?

import azure.cognitiveservices.speech as speechsdk

subscription_key = "my_key"
region = 'francecentral'


text = "Cette phrase n'a jamais été prononcée c'est sûr !"
language = "fr"
voice_name = "fr-FR-HenriNeural"
    
speech_config_azure = speechsdk.SpeechConfig(subscription=subscription_key, region=region)
speech_config_azure.set_speech_synthesis_output_format(speechsdk.SpeechSynthesisOutputFormat.Audio24Khz48KBitRateMonoMp3)

speech_config_azure.speech_synthesis_voice_name = voice_name
audio_config = speechsdk.audio.AudioOutputConfig(filename="static/data/temp/temp.mp3")
speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config_azure, audio_config=audio_config)
speech_synthesis_result = speech_synthesizer.speak_text(text)

if speech_synthesis_result.reason == speechsdk.ResultReason.Canceled:
    print(speech_synthesis_result.cancellation_details.error_details)
Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
{count} votes

2 answers

Sort by: Most helpful
  1. VasaviLankipalle-MSFT 18,706 Reputation points Moderator
    2023-05-04T00:46:29.3166667+00:00

    Hi @Paul Dambricourt and Vissale NEANG, Thanks for bringing this to our notice.

    I would suggest you try regenerating the Subscription key in the Azure portal or please try testing with a different region other than Francecentral.

    User's image

    If you still have the issue in that region, then I would recommend opening a support ticket.

    For a deeper investigation and immediate assistance, if you have a support plan you may file a support ticket, else could you please send an email to azcommunity@microsoft.com with the below details, so that we can create a one-time-free support ticket for you to work closely on this matter. 

    Thread URL: Link to this thread.
    Azure Subscription ID: 
    Subject: Attn Vasavi

    I hope this helps.

    Regards,
    Vasavi

    -Please kindly accept the answer and vote 'Yes' if you feel helpful to support the community, thanks.

    1 person found this answer helpful.

  2. VasaviLankipalle-MSFT 18,706 Reputation points Moderator
    2023-05-05T17:13:42.34+00:00

    Hello @Paul Dambricourt and @Vissale NEANG , Thanks for bringing this to our attention. Sorry for all the inconveniences. We really appreciate your patience.

    The outage in the FranceCentral region has been mitigated. Services appear to be running properly. Please try now and let us know if you still face any issues.

    Create custom service health alerts to stay updated about Azure service issues: https://aka.ms/ash-videos for video tutorials and https://aka.ms/ash-alerts for how-to documentation.

    I hope this helps.

    Regards,
    Vasavi

    -Please kindly accept the answer and vote 'Yes' if you feel helpful to support the community, thanks.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.