Announcements: Microsoft Translator Moves to the Azure portal

Microsoft Translator is now available in the Azure portal. The Microsoft DataMarket platform retired on April 30, 2017.

For Microsoft Translator API subscribers previously subscribed in Microsoft DataMarket, the move to the Azure portal requires a small code change in your applications. This page provides you with the information to move to the new platform.


Benefits of switching to Azure

The move to the Azure portal includes:
  • Introduction to a new Pay-As-You-Go offer.
  • Price discounts for higher monthly volume commitments including overage.

In addition:

  • The free subscription tier continues to be offered for monthly use up to 2 million characters.
  • New users to the Azure portal can sign up for a free 30-day Azure Trial, which includes a $200 USD credit to spend on any Azure Service, or the equivalent in your currency.
  • Azure customers can include a subscription to Microsoft Translator as part of the overall Azure purchase.

 

How to sign up for Microsoft Translator on Azure

1.     Sign up for a Microsoft Azure account (credit card required)

2.   After you have created an Azure account, subscribe to Azure. You will not be charged for Azure unless you use it. Then sign into the Azure portal at http://portal.azure.com.

3.     Add a Microsoft Translator API subscription to your Azure account.

  • Select the + New option.
  • Select Intelligence from the list of services.
  • Select Cognitive Services APIs.
  • Select the API Type option.
  • Select either Text Translation or Speech Translation
  •  In the Pricing Tier section, select the pricing tier that fits your needs.
  • Fill out the rest of the form, and press the Create button
  • You are now subscribed to Microsoft Translator!

4.      Retrieve your authentication key.

  • Go to All Resources and select the Microsoft Translator API you subscribed to.
  • Go to the Keys option and copy your subscription key to access the service.

5.      Learn, test and get support on the API 


Information for Microsoft Translator Hub users 

Your applications can use your existing and your newly created customized systems if you are subscribed to the Microsoft Translator Text API in the Azure portal. 


How to update your code

For Microsoft Translator API users previously subscribed in DataMarket, to continue using the Microsoft Translator API from the Azure portal, you will need to replace the app authentication using your Microsoft DataMarket Client ID and Client Secret with your new Azure key. The single Azure key is used to request an Azure token for the Microsoft Translator service.

Refer to the documentation for getting an Azure token. Learn more on why there are two keys.



Below is an example of requesting an Azure token for the Translator service in C#. You can view a fully functional simple console app in C# for requesting a token on GitHub.

 

Example:

authTokenSource = new AzureAuthToken("https://api.cognitive.microsoft.com/sts/v1.0/issueToken");

            var token = await authTokenSource.GetAccessTokenAsync(this.AzureSubscriptionKeyForText);

 

using System;

using System.Net.Http;

using System.Threading.Tasks;

 

namespace Microsoft.MT.Api.Client

{

    /// <summary>

    /// Client to call Cognitive Services Azure Auth Token service in order to get an access token.

    /// </summary>

    public class AzureAuthToken

    {

        private const string OcpApimSubscriptionKeyHeader = "Ocp-Apim-Subscription-Key";

 

        public Uri ServiceUrl { get; private set; }

 

        /// <summary>

        /// Creates a client to obtain an access token.

        /// </summary>

        /// <param name="serviceUrl">URL of the service to target.</param>

        public AzureAuthToken(string serviceUrl)

        {

            if (string.IsNullOrWhiteSpace(serviceUrl)) throw new ArgumentNullException(nameof(serviceUrl));

 

            Uri actualUri;

            if (!Uri.TryCreate(serviceUrl, UriKind.Absolute, out actualUri))

            {                

                throw new ArgumentException(nameof(serviceUrl), $"Invalid service URL: {serviceUrl}");

            }

            this.ServiceUrl = new Uri(serviceUrl);

        }

 

        /// <summary>

        /// Gets a token for the specified subscription.

        /// </summary>

        /// <param name="subscriptionSecret">Subscription secret key.</param>

        /// <returns>The encoded JWT token.</returns>

        public async Task<string> GetAccessTokenAsync(string subscriptionSecret)

       {

            using (var client = new HttpClient())

            using (var request = new HttpRequestMessage())

            {

                request.Method = HttpMethod.Post;

                request.RequestUri = this.ServiceUrl;

                request.Content = new StringContent(string.Empty);

                request.Headers.TryAddWithoutValidation(OcpApimSubscriptionKeyHeader, subscriptionSecret);

                var response = await client.SendAsync(request);

                response.EnsureSuccessStatusCode();

                var token = await response.Content.ReadAsStringAsync();

                return token;

            }

        }

 

        /// <summary>

        /// Gets a token for the specified subscription. The token is prefixed with "Bearer ".

        /// </summary>

        /// <param name="subscriptionSecret">Subscription secret key.</param>

        /// <returns>The encoded JWT token, prefixed with "Bearer ".</returns>

        public async Task<string> GetBearerAccessTokenAsync(string subscriptionSecret)

        {

            return "Bearer " + await this.GetAccessTokenAsync(subscriptionSecret);

        }

    }

}

 

For more Azure documentation, visit https://azure.microsoft.com/en-us/documentation/articles/?term=portal

Resources for getting started


Additional questions?

View customer questions or add your own on the Microsoft Translator Azure forum at aka.ms/TranslatorAzureForum

Edited on May 2, 2017

Translator

  1. Announcements: Microsoft Translator Moves to the Azure portal
  2. API - Translator Text: How to report an issue with the API
  3. API and Hub: Confidentiality
  4. API - Translator Speech: Microsoft Translator Speech API references
  5. API - Translator Text / Speech: Get a report of your consumption
  6. API - Translator Text / Speech: Why are there two keys for my API subscription?
  7. API - Translator Text: My CAT tool isn't working and is asking for the Client ID and Client Secret
  8. API - Translator Text: Limits
  9. API - Translator Text: How Microsoft Translator counts characters
  10. API - Translator Text: Gender selection in the Speak() method
  11. API - Translator Text: Trados plugin for Microsoft Translator
  12. API - Translator Text: Java- Using SSL with the Microsoft Translator API
  13. API - Translator Text: European datacenter
  14. API - Translator Text: Languages detected by the Detect() method
  15. API - Translator Text: Using Neural MT Systems
  16. API - Translator Text: First few Microsoft Translator API requests succeed, then the calls fail
  17. API - Translator Text: Microsoft Translator with IP filtered firewalls
  18. API - Translator Text: Profanity filtering in the TranslateArray() method
  19. Hub: API Preview released
  20. Hub: Translator Hub Resource Guide
  21. API - Translator Text: Using the Collaborative Translation Framework (CTF)
  22. Hub: August 2016 Release notes
  23. Hub: Deployment of a custom system requires a Microsoft Translator Text API subscription in the Azure portal
  24. Hub: Capacity of custom Microsoft Translator Hub systems
  25. Hub: Building a custom system using a dictionary only
  26. Hub: Deployment of a custom system requires a Microsoft Translator subscription in the Azure portal

Feedback and Knowledge Base