Security, Governance, and Cost Management
Lesson opener
In one line: A role assignment is a person or an application, a role, and a scope. A budget alert is a number you set. Neither one is created by naming a resource well.
Why it matters: Northline's analytics lead is Owner on the subscription because the first tutorial said so. A sandbox experiment runs all weekend. The bill arrives before anyone is paged. The activity log shows the create, and the storage key from lesson 10 is still in a ticket. Figures are illustrative. The budget amount is Northline's choice.
Before this lesson: You can place a resource in a subscription and a resource group, and you know a key does not belong in a prompt.
What you will be able to do
- Describe Microsoft Entra ID as the directory of people and applications.
- Build a role assignment from principal, role, and scope.
- Apply least privilege to a reader of published stock.
- Set a budget alert without inventing a savings percentage.
- Read an activity-log event without storing a secret in it.
Prerequisites
Lessons 2 and 10. You will not change a live directory in the practice.
Identity, permission, and money
Microsoft Entra ID is the identity service for people and applications that sign in to Microsoft clouds (https://learn.microsoft.com/en-us/entra/fundamentals/whatis). Signing in answers who is calling. It does not by itself answer what they may delete.
Azure role-based access control grants access by assigning a role to a security principal at a scope (https://learn.microsoft.com/en-us/azure/role-based-access-control/overview). The three parts are:
- The principal: a user, a group, or an application.
- The role: a set of actions, such as Reader or Contributor. Owner can manage access as well as the resource. It is not the default for an analyst.
- The scope: where the role applies, from a management group down to a resource. A narrower scope is smaller access.
Least privilege means the analyst who reads published/stock/ gets read on that scope, not Owner on the subscription. A nightly factory gets the write it needs on raw/, not the right to assign roles.
Cost management budgets watch spending against an amount you choose and can send an alert (https://learn.microsoft.com/en-us/azure/cost-management-billing/costs/tutorial-acm-create-budgets). People sometimes call this practice FinOps. FinOps is not an Azure switch. A budget does not stop the resource unless you add a control that stops it. This lesson uses the alert first, because a surprise shutdown of the lake is its own incident.
The activity log records control-plane events such as creating or deleting a resource (https://learn.microsoft.com/en-us/azure/azure-monitor/platform/activity-log). It is the audit trail for "who deleted the account." It is not a place to write a secret. Data-plane reads of a file may need diagnostic settings you turn on. Do not claim the activity log contains every file read unless you have configured that.
def allow(role, action):
grants = {
"Reader": {"read"},
"Contributor": {"read", "write"},
"Owner": {"read", "write", "assign-roles"},
}
return action in grants.get(role, set())
assert allow("Reader", "read") is True
assert allow("Reader", "write") is False
assert allow("Reader", "assign-roles") is False
assert allow("Owner", "assign-roles") is TrueTeacher walkthrough: the analyst and the factory
All figures are illustrative.
- The analyst is in Entra ID and is assigned Reader on the published container, not Owner on the subscription.
- The factory's application identity is assigned a write role on
raw/stock/only. - A budget of 500 currency units on the analytics subscription alerts the owner at 80 percent and at 100 percent. 500 and 80 percent are Northline's choices.
- Validation: the analyst can read a published file and cannot delete the storage account. A test delete attempt is denied. The activity log shows the denied control-plane call without a key in the text.
A second workplace case
A contractor needs to restart one failed pipeline for a week. Contributor on the whole subscription would let them change the lake. A role assignment on the factory resource, with an end date, matches the week. When the date passes, the assignment is gone. A shared Owner login would have no end date.
Failure example: Owner, then a quiet bill
Symptom: The analytics subscription doubles over a weekend. The only identity in the log is a shared account named cloud-admin. Nobody can say who started the extra compute.
Diagnosis: Owner was granted on the subscription to a shared login. The budget did not exist, so nothing paged. The root cause is an over-broad principal plus no alert. The resource names were fine.
Correction: Remove the shared Owner. Assign named people the smallest role on the smallest scope. Create the budget alert. Keep secrets out of tickets and out of the activity-log comments.
Validation: cloud-admin can no longer start compute. A named person can. A test spend signal fires the alert to the owner you named. The log entry for the test does not contain an account key.
Guided practice: write one assignment
Scenario: A buyer must read published prices and must not change them. The factory must write raw/price/. The monthly analytics budget is 200 currency units, alert at 50 and 80 percent. Figures are illustrative.
Hints:
- Who is the principal in each case?
- What is the smallest role?
- Does the alert stop the factory?
Complete solution:
The buyer is a user principal with Reader at the published price scope. The factory is an application principal with a write role at raw/price/ only. Neither is Owner on the subscription. The budget is 200 on the analytics subscription with alerts at 50 and 80 percent. The alert emails the owner. It does not stop the factory unless a separate action is added later. Validation: the buyer is denied a delete, the factory can write raw, and a sample alert contains no secret.
Independent practice
Write the assignment and the budget for one real role.
Acceptance criteria:
- You name the principal, the role, and the scope.
- You explain why Owner is or is not required. In this lesson's buyer case it is not.
- You set a budget amount and an alert threshold you chose, marked as a choice.
- You say whether the alert stops resources.
- You say what the activity log is for, and that secrets stay out of it.
Common mistakes
- Owner on the subscription for anyone who "might need it."
- A shared admin login.
- A budget with no alert, or an alert that nobody receives.
- Assuming the activity log lists every blob read without checking diagnostic settings.
- Treating a naming convention as access control.
Quick check
- What are the three parts of a role assignment?
- Does Reader include assigning roles?
- Does a budget alert stop spend by itself?
- What does the activity log help you answer?
- Why is a shared
cloud-admina problem?
Answers:
- Principal, role, and scope.
- No. Owner includes managing access. Reader does not.
- No. It notifies. Stopping spend is a further control.
- Who changed or deleted a resource at the control plane.
- You cannot tell which person acted, and the access is broader than one job.
Quiz alignment
The quiz asks you to build a least-privilege assignment, to treat budgets as alerts you configure, and to keep secrets out of the audit trail.
Lesson summary
Entra ID says who signed in. A role assignment says what they may do, and where. Owner is rare. Budgets alert at numbers you choose. The activity log is the control-plane trail. Secrets stay in the secret store, not in prompts, tickets, or log text.
Bridge to the next lesson
The last lesson packs the whole path: ERP to the API, the lake, Synapse, Databricks, Azure Machine Learning, Power BI, Copilot, and agents. You will write the inventory, the risks, and the rollback.