How To Create An Azure Cognitive Service Account Using Azure PowerShell

Azure Cognitive Services are used to build an intelligent application without having an AI or data science skill. Azure PowerShell contains a set of modules to manage Azure resources. 

Azure Cognitive Services

 
Azure Cognitive Services are APIs, SDKs, and services which help to build intelligent applications without having AI or data science knowledge and skills. Azure Cognitive Services provide APIs for Vision, Speech, Language, Decision, and Web Search.
 
Prerequisites

Before you begin to utilize PowerShell to oversee the Azure PowerShell, ensure that the Azure PowerShell has been installed. If not installed, here is an article How to install the Azure PowerShell module. You need to do this only once for each computer from which you are running Azure PowerShell commands. 

Connect to Azure Portal

 
Connect to Azure Portal using Connect-AzureRmAccount cmdlet.
 
Connect-AzureRmAccount

How To Create A Azure Cognitive Service Account Using Azure PowerShell 

Creating Azure Resource Group

 
Create an Azure Resource Group so that we can deploy, update, and test web apps in a group. Azure Resource Group is a new approach to group a collection of resources that share a unified life cycle. The benefit of using resource groups in Azure is that we can group all resources that belong to one application.

You can create Resource Groups in Azure using New-AzureRmResourceGroup cmdlets. The required parameters are,

  • Name - Specify the name of the resource group.
  • Location - Specify the Azure data center location of the resource group, such as South India and West US.
    1. $ResourceGroupName = "HubflyIoTRG1730"  
    2. $location = "WestUS"  
    3. New - AzureRmResourceGroup - Name $ResourceGroupName - Location $location  

How To Create A Azure Cognitive Service Account Using Azure PowerShell 

Now, check your Azure portal  -- the resource group will be created.

How To Create A Azure Cognitive Service Account Using Azure PowerShell 

Creating an Azure Cognitive Service Account

 
Create an Azure Storage account using New-AzureRmCognitiveServicesAccount cmdlet. The required parameters are,
  • ResourceGroupName - Specify the name of the resource group.
  • Name - Specify the name of the account.
  • Type - Specify the type of account to create.
  • SkuName - Specify the Sku for the account. The acceptable values are,

    • F0 (free tier),
    • S0
    • S1
    • S2
    • S3
    • S4

  • Location - Specify the Azure data center location of the resource group, such as South India and West US.
    1. New-AzureRmCognitiveServicesAccount -ResourceGroupName $ResourceGroupName -name HubflyCognitiveService -Type CognitiveServices -SkuName S0 -Location 'WestUS'    

How To Create A Azure Cognitive Service Account Using Azure PowerShell
 
Now, check your Azure portal. The HubflyCognitiveService is now created.

How To Create A Azure Cognitive Service Account Using Azure PowerShell 

Final Code

  1. Connect - AzureRmAccount  
  2. $name = Read - Host 'Please Enter the name of the Coginitive Service'  
  3. $ResourceGroupName = Read - Host 'Please Enter the Resource group name'  
  4. $location = Read - Host 'Please Enter the Location'  
  5. $skuName = "S0"  
  6. New - AzureRmResourceGroup - Name $ResourceGroupName - Location $location  
  7. New - AzureRmCognitiveServicesAccount - ResourceGroupName $ResourceGroupName - name $name - Type CognitiveServices - SkuName $skuName - Location $location  

That's it. I hope you have learned how to create a Cognitive Service account using Azure PowerShell programmatically. Feel free to fill up the comment box below if you need any assistance.


Similar Articles