Lesson 3 of 6 Responsible AI Principles

Protecting Privacy and Security in AI Systems

This lesson explains privacy and security, the principle that AI systems should be secure and respect privacy. AI systems depend on data, so the way they collect, use and protect that data is central to trust.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify privacy considerations, such as data minimization and purpose limitation.
  • Identify security considerations, such as Microsoft Entra ID authentication and least privilege.
  • Choose a measure that supports privacy in a scenario.

Privacy considerations

Privacy concerns how personal data is collected, used, shared and kept. A privacy-respecting AI system collects only the data it needs (data minimization), uses it only for the purposes people were told about and, where required, agreed to, keeps it only as long as necessary, and complies with regulations such as the General Data Protection Regulation (GDPR).

Personal data can also leak through the AI itself, for example when a model repeats sensitive data from its prompt in a response to another user. PII detection and redaction with Azure Language removes names, phone numbers, email addresses and similar data from text before it is stored or sent to a model. Microsoft does not use customers' prompts and outputs sent to Foundry Models sold by Azure to train its foundation models.

The following diagram shows personal data removed before text is stored or sent to a model.

Data minimization with PII redaction. Text that contains names, phone numbers, email addresses and card numbers passes through Azure Language PII detection, which returns a copy with those values masked. Only the redacted text is stored or sent to the generative model, so the model never receives personal data it does not need and cannot repeat it to another user.
Redaction applies data minimization to AI workloads.
True or false

Personal data in AI systems

Exam skills 1.1.3

Check four statements about privacy in AI solutions.

Log in to try this activity Interactive activities are free with an account.

Security considerations

Security protects the AI system, its data and its users from attack and misuse. Applications should authenticate with Microsoft Entra ID rather than shared API keys, give users and applications only the roles they need (least privilege), encrypt data, restrict network access where appropriate, and defend against prompts that try to extract confidential instructions or data. Agents that can take actions need particular care, because a manipulated agent can misuse its tools.

Applying the principle: a support assistant

Consider a customer support assistant built with Foundry that answers questions about orders. Privacy and security shape several design decisions. The assistant retrieves only the order data needed for the current customer, rather than giving the model access to every order. Conversation logs are passed through PII detection and redaction before they are stored for quality review, and they are deleted after a defined retention period.

On the security side, the application authenticates to Foundry with a managed identity instead of an API key, and that identity has only the role needed to call the model. Support staff who review conversations have access only to the redacted logs. The following table summarizes how each risk is addressed.

RiskMeasure
Collecting more personal data than neededRetrieve only the current customer's order data
Personal data in stored logsPII detection and redaction before storage
Keeping data too longA defined retention period with automatic deletion
Leaked credentialsManaged identity and Microsoft Entra ID instead of API keys
Excessive accessLeast-privilege roles for the application and for staff
Sort into groups

Privacy or security?

Exam skills 1.1.3

Decide whether each measure in a support assistant mainly addresses privacy or security.

Log in to try this activity Interactive activities are free with an account.
Worked example

Protecting customer data

A support team wants to summarize chat transcripts with a generative model. The transcripts contain customers' names, phone numbers and card details, which are not needed in the summaries. Which measure best supports the privacy and security principle?

Redacting the personal data with Azure Language PII detection before the transcripts are sent to the model applies data minimization: the model never receives data it does not need. Adding an instruction such as do not repeat personal data is weaker, because the data still reaches the model and an instruction is not a guarantee. Raising the content filter threshold addresses harmful content, not personal data.

Check yourself

Are customers' prompts and outputs used to train Microsoft's foundation models?

Show answer

No. They are not used to train the foundation models.

Exam Tips

Remember for the exam

  • Data minimization and PII redaction are privacy measures.
  • Microsoft Entra ID authentication and least-privilege roles are security measures.
  • Customer prompts and outputs are not used to train Microsoft's foundation models.