How To Create Azure Cognitive Services PowerShell

How To Create Azure Cognitive Services PowerShell

In this Azure tutorial, we will discuss How To Create Azure Cognitive Services PowerShell. Along with this, we will also discuss a few other topics like Create Azure Cognitive Services Using PowerShell script and How To Create Azure Cognitive Services Azure Portal, Subscription Key For Microsoft Cognitive Services, Azure Text To Speech.

How To Create Azure Cognitive Services PowerShell? You can create Azure Cognitive Services in PowerShell using the following steps

  • Connect to Azure Portal using Connect-AzureRmAccount PowerShell cmdlet.
  • Create a Resource Group using PoweNew-AzureRmResourceGroup PowerShell cmdlet.
  • Create an Azure Cognitive Service using New-AzureRmCognitiveServicesAccount cmdlet

We will see in detail steps below.

How To Create Azure Cognitive Services PowerShell

Well, here we will discuss How To Create Azure Cognitive Services Account PowerShell. We can also able to create the Azure Cognitive Services Account using Azure Portal that we will see later. Now we will discuss How To Create Azure Cognitive Services PowerShell. Before starting the actual development, we should know What is Azure Cognitive Services and what are the Prerequisites needed to create Azure Cognitive Services PowerShell.

What is Azure Cognitive Services

Microsoft Azure Cognitive services is an excellent service from Microsoft that provides a number of Azure service APIs that actually helps you with the ability to make it easy to enhance your applications in different areas like vision, speech, knowledge, search and language, etc. These APIs provide you the ability to implement the AI features in these areas. Check out some more information on Azure Cognitive services now.

Prerequisites

  • Make sure to Install the PowerShell latest version with the Azure PowerShell module.
  • You must have a valid Azure Subscription or a Valid Azure Account. If you don’t have till now, create an Azure Free Account now.

Assuming that you have all the Prerequisites are ready, let’s start developing the actual functionality. Follow the below steps to Create Azure Cognitive Services using PowerShell.

Open the Windows PowerShell or PowerShell ISE as Run as Administrator mode.

How To Create Azure Cognitive Services PowerShell

Connect to Azure Portal

As we need to create the Azure Cognitive Services in the Azure Portal. So we need to connect to the Azure Portal, After that only we can able to create any of the Azure Resource in the Azure Portal.

You need to use the below PowerShell cmdlet to connect to the Azure Portal.

PS C:\WINDOWS\system32> Connect-AzureRmAccount

Once you will run the above PowerShell cmdlet, It will prompt you to enter your Azure Credentials. Enter your Azure credentials and then click on the Sign-in button.

Create Azure Cognitive Services PowerShell

Create Azure Resource Group PowerShell

Now the next step is we need to create a Resource Group that we need to create the Azure Cognitive Services. You can able to group Azure resources together that belong to one application in Azure. This is one of the benefits of Azure Resource Group.

Use the below PowerShell cmdlet to create a Resource Group in Azure

C:\WINDOWS\system32> New-AzureRmResourceGroup

Below are parameters value we need to provide along with this PowerShell cmdlet to create the Resource Group in Azure

  • Name: You need to provide the unique name of the Resource Group.
  • Location: Specify the location for your Azure Resource Group

Below is the script with the parameter value

Connect-AzureRmAccount
$myrsggrpname = "Demo123"  
$mylocation = "EastUS"  
New-AzureRmResourceGroup -Name $myrsggrpname -Location $mylocation 

Now once you will run the above script, you can able to see below that the Resource Group got created Successfully

Create Azure Cognitive Services using PowerShell

Now just to cross check that the Resource Group is Created, Let’s verify in the Azure Portal.

Log in to the Azure Portal, search for the Resource Group and then click on the search result Resource Group to navigate to the Resource Group Page, Then you can able to see the Resource Group is present in the list of Resource Groups as shown below

Create Azure Cognitive Services by using PowerShell

Now that our Resource Group is created successfully, the next step is we need to create the Azure Cognitive Services.

Create the Azure Cognitive Services Account PowerShell

We can create the Azure Cognitive Services Account using the New-AzureRmCognitiveServicesAccount cmdlet.

Below are the set of parameters those we need to pass value with the New-AzureRmCognitiveServicesAccount cmdlet

  1. ResourceGroupName: Specify the Resource Group name that you want to use in this case
  2. Name: Provide a unique name for the Azure Cognitive Services Account.
  3. Type: The next parameter is, you need to specify the type of the Azure Cognitive Services Account.
  4. SKUName: This is related to the pricing tier. The value can be F0(Free tier), S1, S2. S3, etc. You can use the F0 tier if it is just for demo purposes. Choose this value based on your requirement.
  5. Location: You need to provide the location for the Azure data center of the Resource group.

You can use the below script to create the Azure Cognitive Services Account.

Connect-AzureRmAccount
$myrsggrpname = "Demo123"  
$mylocation = "EastUS"  
New-AzureRmCognitiveServicesAccount -ResourceGroupName $myrsggrpname -name MyDemotestCognitiveService -Type CognitiveServices -SkuName S0 -Location $mylocation 

You can able to see, after executing the above PowerShell script, the Azure Cognitive Services Account created successfully without any issue

Create the Azure Cognitive Services Account PowerShell

Now, to make sure it is created successfully, we will check in the Azure Portal if it is created or not. To check that Login to the Azure Portal, Search for the Cognitive Services and click on the search result Cognitive Services to navigate to the Cognitive Services page.

You will see the list of Cognitive Services those you have created already, As shown below, you will find out the newly created Azure Cognitive Services Account.

azure cognitive services create

How To Create Azure Cognitive Services Azure Portal

We have discussed above, How To Create Azure Cognitive Services PowerShell. Now the time to discuss, How To Create Azure Cognitive Services Azure Portal. Follow the below steps to Create Azure Cognitive Services Azure Portal

I have already written an article on the same. So Create Azure Cognitive Services Azure Portal now.

So, This is How To Create Azure Cognitive Services PowerShell and How To Create Azure Cognitive Services Azure Portal.

Subscription Key For Microsoft Cognitive Services

Well, here we will discuss, How to get the Subscription Key For Microsoft Cognitive Services. We have already created An Microsoft Azure Cognitive Services by following the above steps. Follow the below steps to get the Subscription Key For Microsoft Cognitive Services.

Login to the Azure Portal

Once you logged in to the Azure Portal, then you need to search for the Cognitive Services. Then click on the search result as shown below

Subscription Key For Microsoft Cognitive Services

On the Cognitive services page, you can able to see the list of Cognitive services that you have created already. Click on the Azure Cognitive service for which one you want to get the Subscription key values.

On your Azure Cognitive service page, click on the Keys and Endpoint link from the left navigation. Then you can able to see the Key 1 and Key 2 value and you can click on the copy button as highlighted to copy the key values. You can click on the Show Keys button to see the value of those Key 1 and Key 2.

If you are not happy with the Key 1 and Key 2 values then you can also regenerate those values by clicking on the Regenerate key1 and Regenerate key2 button from the top as highlighted below.

Along with the Key values, you can also able to get the ENDPOINT and LOCATION of the Azure Cognitive service.

You can either use the Key 1 or Key 2 value to access the Azure Cognitive service from outside.

How to get the Subscription Key For Microsoft Cognitive Services

This is how you can able to get the Subscription Key For Microsoft Cognitive Services.

Azure Text To Speech

Azure Text to speech service is an excellent service from Microsoft that actually helps your applications, tools, or devices to convert text to speech like from human. As part of the Azure Text to speech service, there are more than 75 standard voices are available in more than 45 languages.

The languages are Arabic, Bulgarian, Catalan, Czech, Danish, German, Greek, English, Spanish, Finnish, French, Hebrew, Hindi, Croatian, Hungarian, Indonesian, Italian, Japanese, Korean, Malay, Dutch, Polish, Portuguese, Romanian, Russian, Slovak, Tamil, Telugu, Thai, Turkish, Mandarin, Cantonese, Mandarin, etc.

Including this, another 5 neural voices are also available for a few languages. The list of languages is Arabic, Bulgarian, Catalan, Czech, Danish, German, Greek, English, Australian, English, Spanish, Finnish, French, Hindi, Croatian, Italian, Japanese, Korean, Malay, Dutch, Polish, Romanian, Russian, Slovak, Swedish, Tamil, Telugu, Thai, Turkish, Vietnamese, etc.

Key Features Of Azure Text To Speech Service

Azure Text To Speech Service provides many important features. Out of those, here we will discuss a few key features of Azure Text To Speech Service.

  • Azure Text to Speech Service provides the Azure SDKs and the REST API to convert from Text to Speech.
  • Easily you can make your Application to use the service with 45 languages support.
  • The output can be customized with Speech Synthesis Markup Language (SSML).

In order to use the Text To Speech Service in your application, you must have an Azure account and Speech service subscription as a prerequisite. If you don’t have an Azure account, Create a Free Azure Account now.


Pricing Azure Text To Speech Service

One important point to note down in terms of Pricing for the Azure Text To Speech Service is you need to pay for each character including the punctuation, phonemes, and pitch that you want to convert to speech.

Below are the cases where you need to pay for the Azure Text To Speech Service

  • The text you are passing to the Azure Text To Speech Service
  • You need to pay for all the markups in the text field.
  • Next is, you need to pay for the tabs, Letters, spaces, punctuations, etc.

Implementation of the Azure Text To Speech Service

As part of the implementation of the Azure Text To Speech Service to your application, the first and the most important step is, you need to initialize the SpeechConfig. The initialization can be done in many ways, those are as below

  1. The first way is you need to pass the key and the region associated with the Azure Text To Speech Service as the parameters along with the subscription.
  2. You can pass the service Endpoint. Optionally, you can pass an authorization token along with the service Endpoint.
  3. The third way to initialize the SpeechConfig is to pass a host address. In this case also the Optionally, you can pass an authorization token if you want.
  4. The fourth way is, you can also pass an authorization token with the associated region.

If you will consider the first way, then the syntax will be like below

static async Task Method1() 
    {
        var myconfig = SpeechConfig.FromSubscription("Enter your SubscriptionKey here", "Enter Your Service Region here");
    }

You may also like following the below articles

Wrapping Up

Well, in this article, we discussed How To Create Azure Cognitive Services PowerShell, Create Azure Cognitive Services PowerShell script, and How To Create Azure Cognitive Services Azure Portal, Subscription Key For Microsoft Cognitive Services, Azure Text To Speech. Hope you have enjoyed this article !!!

Leave a Comment