0
0
Azurecloud~30 mins

Security recommendations and score in Azure - Mini Project: Build & Apply

Choose your learning style9 modes available
Security Recommendations and Score in Azure
📖 Scenario: You are managing an Azure subscription and want to improve its security. Azure Security Center provides recommendations and a security score to help you understand and fix security issues.In this project, you will create a simple script to retrieve security recommendations and the current security score for your Azure subscription.
🎯 Goal: Build a script that connects to Azure Security Center, fetches the list of security recommendations, and retrieves the current security score for your subscription.
📋 What You'll Learn
Create a variable to hold the Azure subscription ID
Create a variable to hold the resource provider namespace for security
Write a function to fetch security recommendations from Azure Security Center
Write a function to fetch the current security score
Combine the functions to output the recommendations and score
💡 Why This Matters
🌍 Real World
Azure Security Center helps cloud administrators monitor and improve the security posture of their Azure subscriptions by providing actionable recommendations and a security score.
💼 Career
Understanding how to retrieve and use security recommendations and scores is essential for cloud security engineers and administrators to maintain secure cloud environments.
Progress0 / 4 steps
1
Set up Azure subscription ID and resource provider
Create a variable called subscription_id and set it to the string "12345678-1234-1234-1234-123456789abc". Then create a variable called security_provider and set it to the string "Microsoft.Security".
Azure
Need a hint?

Use simple string assignment to create the variables.

2
Create a function to fetch security recommendations
Define a function called get_security_recommendations that takes subscription_id as a parameter. Inside the function, create a variable called recommendations_endpoint and set it to the string f"https://management.azure.com/subscriptions/{subscription_id}/providers/Microsoft.Security/assessments?api-version=2020-01-01".
Azure
Need a hint?

Use an f-string to build the URL with the subscription ID.

3
Create a function to fetch the security score
Define a function called get_security_score that takes subscription_id as a parameter. Inside the function, create a variable called score_endpoint and set it to the string f"https://management.azure.com/subscriptions/{subscription_id}/providers/Microsoft.Security/secureScores?api-version=2020-01-01".
Azure
Need a hint?

Use an f-string to build the URL with the subscription ID for the security score.

4
Combine functions to get recommendations and score URLs
Create two variables: recommendations_url and score_url. Assign recommendations_url the result of calling get_security_recommendations(subscription_id). Assign score_url the result of calling get_security_score(subscription_id).
Azure
Need a hint?

Call each function with subscription_id and assign the results to the variables.