Loading certification materials...
Loading certification materials...
# Create Azure AI resource with custom subdomain
az cognitiveservices account create \
--name myai-service \
--resource-group myai-rg \
--kind TextAnalytics \
--sku S0 \
--location eastus \
--custom-domain myai-custom \
--yes
resource aiService 'Microsoft.CognitiveServices/accounts@2023-05-01' = {
name: 'myai-service'
location: location
sku: {
name: 'S0'
}
kind: 'TextAnalytics'
properties: {
customSubDomainName: 'myai-custom'
networkAcls: {
defaultAction: 'Deny'
virtualNetworkRules: [
{
id: subnet.id
ignoreMissingVnetServiceEndpoint: false
}
]
}
publicNetworkAccess: 'Enabled'
}
}
const { DefaultAzureCredential } = require("@azure/identity");
const { AzureKeyCredential, TextAnalyticsClient } = require("@azure/ai-text-analytics");
// Use managed identity
const credential = new DefaultAzureCredential();
const client = new TextAnalyticsClient(
"https://myai-custom.cognitiveservices.azure.com/",
credential
);
Question 1:
Which authentication method provides the most secure way to access Azure AI services from an Azure Function?
A) Access keys in application settings
B) System-assigned managed identity
C) Service principal with client secret
D) Shared access signatures
Answer: B
System-assigned managed identity provides automatic credential management and rotation.