Azure Cognitive Services Account
This page shows how to write Terraform and Azure Resource Manager for Cognitive Services Account and write them securely.
azurerm_cognitive_account (Terraform)
The Account in Cognitive Services can be configured in Terraform with the resource name azurerm_cognitive_account
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_cognitive_account" "az-speech-cog" {
name = format("cog-%s-speech-prod-001", var.name)
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
kind = "SpeechServices"
// If you already have a S0 service configured you'll need to set this to S1
resource "azurerm_cognitive_account" "speech" {
name = var.custom_speech_account_name
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
kind = "SpeechServices"
sku_name = var.custom_speech_account_sku
resource "azurerm_cognitive_account" "vision" {
name = "iot-vision"
location = azurerm_resource_group.iot.location
resource_group_name = azurerm_resource_group.iot.name
kind = "CustomVision.Training"
resource "azurerm_cognitive_account" "translation" {
kind = "TextTranslation"
location = var.az_location
name = var.name
resource_group_name = var.resource_group_name
sku_name = "S1"
resource "azurerm_cognitive_account" "computervision" {
name = var.vision
location = var.location
resource_group_name = var.resource_group_name
kind = var.api_kind
resource "azurerm_cognitive_account" "computervision" {
name = "computer-vision-ocr"
location = azurerm_resource_group.main.location
resource_group_name = azurerm_resource_group.main.name
kind = "ComputerVision"
sku_name = "S1"
resource "azurerm_cognitive_account" "computervision" {
name = var.vision
location = var.location
resource_group_name = var.resource_group_name
kind = var.api_kind
resource "azurerm_cognitive_account" "example" {
name = "example-account"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
kind = "Face"
resource "azurerm_cognitive_account" "vision" {
name = "iot-vision"
location = azurerm_resource_group.iot.location
resource_group_name = azurerm_resource_group.iot.name
kind = "CustomVision.Training"
resource "azurerm_cognitive_account" "cognitive_account" {
name = var.name
location = var.location
resource_group_name = var.resource_group_name
kind = var.kind
sku_name = var.cs_sku_name
Parameters
-
custom_subdomain_name
optional - string -
endpoint
optional computed - string -
id
optional computed - string -
kind
required - string -
location
required - string -
name
required - string -
primary_access_key
optional computed - string -
qna_runtime_endpoint
optional - string -
resource_group_name
required - string -
secondary_access_key
optional computed - string -
sku_name
required - string -
tags
optional - map from string to string -
network_acls
list block-
default_action
required - string -
ip_rules
optional - set of string -
virtual_network_subnet_ids
optional - set of string
-
-
timeouts
single block
Explanation in Terraform Registry
Manages a Cognitive Services Account. -> Note: Version v2.65.0 of the Azure Provider and later will attempt to Purge the Cognitive Account during deletion. This feature can be disabled using the
features
block within theprovider
block, see the provider documentation on the features block for more information.
Microsoft.CognitiveServices/accounts (Azure Resource Manager)
The accounts in Microsoft.CognitiveServices can be configured in Azure Resource Manager with the resource name Microsoft.CognitiveServices/accounts
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
{
"contentVersion": "1.0.0.0",
"parameters": {
"workbookDisplayName": {
"type": "string",
{
"contentVersion": "1.0.0.0",
"parameters": {
"workbookDisplayName": {
"type": "string",
{
"contentVersion": "1.0.0.0",
"parameters": {
"workbookDisplayName": {
"type": "string",
{
"contentVersion": "1.0.0.0",
"parameters": {
"workbookDisplayName": {
"type": "string",
Parameters
apiVersion
required - stringidentity
optionaltype
optional - stringThe identity type.
userAssignedIdentities
optional - undefinedThe list of user assigned identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}
kind
optional - stringThe kind (type) of cognitive service account.
location
optional - stringThe geo-location where the resource lives
name
required - stringThe name of Cognitive Services account.
properties
requiredallowedFqdnList
optional - arrayapiProperties
optionalaadClientId
optional - string(Metrics Advisor Only) The Azure AD Client Id (Application Id).
aadTenantId
optional - string(Metrics Advisor Only) The Azure AD Tenant Id.
additionalProperties
optional - objectUnmatched properties from the message are deserialized this collection
eventHubConnectionString
optional - string(Personalization Only) The flag to enable statistics of Bing Search.
qnaAzureSearchEndpointId
optional - string(QnAMaker Only) The Azure Search endpoint id of QnAMaker.
qnaAzureSearchEndpointKey
optional - string(QnAMaker Only) The Azure Search endpoint key of QnAMaker.
qnaRuntimeEndpoint
optional - string(QnAMaker Only) The runtime endpoint of QnAMaker.
statisticsEnabled
optional - boolean(Bing Search Only) The flag to enable statistics of Bing Search.
storageAccountConnectionString
optional - string(Personalization Only) The storage account connection string.
superUser
optional - string(Metrics Advisor Only) The super user of Metrics Advisor.
websiteName
optional - string(Metrics Advisor Only) The website name of Metrics Advisor.
customSubDomainName
optional - stringOptional subdomain name used for token-based authentication.
disableLocalAuth
optional - booleanencryption
optionalkeySource
optional - stringEnumerates the possible value of keySource for Encryption.
keyVaultProperties
optionalidentityClientId
optional - stringkeyName
optional - stringName of the Key from KeyVault
keyVaultUri
optional - stringUri of KeyVault
keyVersion
optional - stringVersion of the Key from KeyVault
migrationToken
optional - stringResource migration token.
networkAcls
optionaldefaultAction
optional - stringThe default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated.
ipRules
optional arrayvalue
required - stringAn IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78).
virtualNetworkRules
optional arrayid
required - stringFull resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'.
ignoreMissingVnetServiceEndpoint
optional - booleanIgnore missing vnet service endpoint or not.
state
optional - stringGets the state of virtual network rule.
publicNetworkAccess
optional - stringWhether or not public endpoint access is allowed for this account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'.
restore
optional - booleanrestrictOutboundNetworkAccess
optional - booleanuserOwnedStorage
optional arrayidentityClientId
optional - stringresourceId
optional - stringFull resource id of a Microsoft.Storage resource.
sku
optionalcapacity
optional - integerIf the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted.
family
optional - stringIf the service has different generations of hardware, for the same SKU, then that can be captured here.
name
required - stringThe name of the SKU. Ex - P3. It is typically a letter+number code
size
optional - stringThe SKU size. When the name field is the combination of tier and some other value, this would be the standalone code.
tier
optional - stringThis field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT.
tags
optional - stringResource tags.
type
required - string
Frequently asked questions
What is Azure Cognitive Services Account?
Azure Cognitive Services Account is a resource for Cognitive Services of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Cognitive Services Account?
For Terraform, the errbufferoverfl/pearl-memory, jwendl/custom-commands-terraform-provider and Abisaha/Kubernetes_sock source code examples are useful. See the Terraform Example section for further details.
For Azure Resource Manager, the scautomation/Azure-Inventory-Workbook, VJchand-star/Azure and rb-cloud-guru/Azure_Dashboard source code examples are useful. See the Azure Resource Manager Example section for further details.