03 Secure Azure AI Services
03 Secure Azure AI Services
n
• Azure AI services provides multiple layers of security that you should
consider when implementing a solution.
Regenerate keys
• You should regenerate keys regularly to protect against the risk of keys
being shared with or accessed by unauthorized users. You can regenerate
keys using the Azure portal, or using the az cognitiveservices account
keys regenerate Azure command-line interface (CLI) command.
• Each AI service is provided with two keys, enabling you to regenerate keys
without service interruption. To accomplish this:
Consider
authentication
Regenerate keys
• If you're using both keys in production, change your code so that only one
key is in use. For example, configure all production applications to use key
1.
• Regenerate key 2.
• Switch all production applications to use the newly regenerated key 2.
• Regenerate key 1
• Finally, update your production code to use the new key 1.
• For example, to regenerate keys in the Azure portal, you can do the
following:
• There are different ways you can authenticate against Azure AI services
using Microsoft Entra ID, including:
Consider
authentication
Microsoft Entra ID authentication
• Authenticate using service principals
• The overall process to authenticate against Azure AI services using service
principals is as follows:
• Create a custom subdomain
• For example, you can create a subdomain using PowerShell in the Azure
Cloud Shell.
• Finally, you assign the Cognitive Services Users role to your service
principal by running:
• You can assign each type of managed identity to a resource either during
creation of the resource, or after it has already been created.
Consider
authentication
Microsoft Entra ID authentication
• Authenticate using managed identities
• For example, suppose you have a virtual machine in Azure that you intend to
use for daily access to Azure AI services.
• To enable a system-assigned identity for this virtual machine, first you make
sure your Azure account has the Virtual Machine Contributor role.
• Then you can run the following command using Azure CLI in the Azure Cloud
Shell terminal:
1. Go to the Azure AI services resource you want to grant the virtual machine's
managed identity access.
• Limiting what users can see is always a great idea, since they can’t
compromise what they can’t see.
2. You want to store the subscription keys for an Azure AI Services resource
securely, so that authorized apps can retrieve them when needed. What kind of
Azure resource should you provision.
d) Azure Storage
e) Azure Key Vault
f) Azure App Service
Knowledge check
3. When running code on your computer that connects to Azure AI Services, you
receive an error that access is denied due to Virtual Network/Firewall rules.
What configuration do you need to set in the Azure AI Services instance?