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.

Personal data in AI systems
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.
| Risk | Measure |
|---|---|
| Collecting more personal data than needed | Retrieve only the current customer's order data |
| Personal data in stored logs | PII detection and redaction before storage |
| Keeping data too long | A defined retention period with automatic deletion |
| Leaked credentials | Managed identity and Microsoft Entra ID instead of API keys |
| Excessive access | Least-privilege roles for the application and for staff |
Privacy or security?
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.
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.