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
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.
- $ResourceGroupName = "HubflyIoTRG1730"
- $location = "WestUS"
- New - AzureRmResourceGroup - Name $ResourceGroupName - Location $location
Now, check your Azure portal -- the resource group will be created.
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.
- New-AzureRmCognitiveServicesAccount -ResourceGroupName $ResourceGroupName -name HubflyCognitiveService -Type CognitiveServices -SkuName S0 -Location 'WestUS'
Now, check your Azure portal. The HubflyCognitiveService is now created.
Final Code
- Connect - AzureRmAccount
- $name = Read - Host 'Please Enter the name of the Coginitive Service'
- $ResourceGroupName = Read - Host 'Please Enter the Resource group name'
- $location = Read - Host 'Please Enter the Location'
- $skuName = "S0"
- New - AzureRmResourceGroup - Name $ResourceGroupName - Location $location
- 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.