Actions give you the ability to rapidly respond to changes in your environment. For example, you can configure an action that stops and deallocates Azure VMs that accrue spends of over $200 a month. Here, a policy tracks your VMs, looking for an increase in spend over $200 a month. The action attached to that policy takes corrective measures, such as, stopping and deallocating the VMs that the policy identifies.
Actions can help you in these ways:
Actions can work on their own or in tandem with policies. In the latter case, policies locate deviations from operational norms and actions help you take corrective measures in response to those deviations. You can enable actions to govern your Azure infrastructure from these parts of the Tanzu CloudHealth platform:
Configure one or more of these actions for governing your Azure Virtual Machines (VMs):
In order to use Azure Actions in the Tanzu CloudHealth platform, associate a custom role with each Azure Service Principal. Tanzu CloudHealth assumes this role when performing Actions on your behalf.
Tanzu CloudHealth enables Actions at the service principal level. Actions are executed through a custom role that is associated with each service principal. Use Azure PowerShell to associate a custom role for each service principal.
Ensure that you have administration privileges for each service principal with which you want to associate the custom role.
Click the Enable button next to the service principal for which you want to enable Azure Actions. A PowerShell script customized for that service principal appears. By default, Tanzu CloudHealth assigns the built-in Azure Contributor role in the PowerShell script. For more information on what actions this role can perform, click here.
If you prefer to assign Tanzu CloudHealth a more restrictive role than the default Contributor one, create your own role. Here is an example.
$role = Get-AzureRmRoleDefinition "Contributor"
$role.Id = $null
$role.Name = "CHTActions"
$role.Description = "Grants access to Actions"
$role.AssignableScopes.Clear()
$role.Actions.Clear()
$role.Actions.Add("Microsoft.Compute/*/write")
$role.Actions.Add("Microsoft.Compute/*/action")
$role.Actions.Add("Microsoft.ClassicCompute/*/write")
$role.Actions.Add("Microsoft.ClassicCompute/*/action")
$role.Actions.Add("Microsoft.Sql/*/write")
$role.Actions.Add("Microsoft.Sql/*/action")
$role.Actions.Add("Microsoft.Storage/*/write")
$role.Actions.Add("Microsoft.Storage/*/action")
$role.Actions.Add("Microsoft.ClassicStorage/*/write")
$role.Actions.Add("Microsoft.ClassicStorage/*/action")
$role.NotActions.Add("*/Delete")
New-AzureRmRoleDefinition -Role $role
For more examples, see Manage Role-Based Access Control with Azure PowerShell.
Run the script that Tanzu CloudHealth created for the service principal. If you created your own role, replace Contributor
in the script with the name of the role you created.
Associate an action with a policy so that when a policy condition evaluates to true, the action is executed.
For all asset types, the following Actions are available:
You can stagger Actions based on the Wait function. For example, you can stop a Virtual Machine, create a JIRA issue, and inform someone of these actions through an email. You can create a sequence of events that make up the action as follows: 1. Stop and Deallocate Azure Virtual Machines. 2. Create JIRA Issue. 3. Email DevOps.
To ensure that the sequence of events runs correctly, click the Test Rule button for the rule.
For more information about associating actions with a policy, see Configure Rules.
In order to add traceability and accountability, you can run Azure actions through an approval process. When an action is triggered, the Approver receives an email notification. If the Action is acceptable to the Approver, they can approve it through the email. If other Approvers are part of the process, a notification is then sent to the next Approver in the sequence. When all Approvers have signed off, Tanzu CloudHealth runs the Action.
Standard Azure Actions available in the Tanzu CloudHealth platform do not require an approval process by default. Create a custom Action that combines one or more standard Actions and associate Approvers with that Action.
In addition to associating Azure Actions with Policies, you can manually execute Azure Actions in the Tanzu CloudHealth platform.
In the Virtual Machine Rightsizing report (Recommendations > Virtual Machine Rightsizing), each row has an associated Actions dropdown.
Because this is the Rightsizing report, one possible Action to take here would be Resize Azure Virtual Machine. Click this option from the Actions dropdown and select the VM size to which you want to resize.
Click Execute Action. Tanzu CloudHealth resizes the VM using the privileges in the custom role associated with the service principal to which the VM belongs.
The CIS Azure Foundations policy performs checks for Center for Internet Security (CIS) security benchmarks CIS Microsoft Azure Foundations Benchmark v1.3.0. The policy can monitor your Azure accounts, services, and resources. It identifies issues based on the CIS benchmarks and makes recommendations for how you can improve your security.
Tanzu CloudHealth manages this policy and will update it periodically to meet additional CIS benchmarks. You can customize the rules in this policy within certain constraints. You can also enable and disable rules within the default policy.
To run the CIS Azure Foundations policy, Tanzu CloudHealth must collect asset metadata for a number of services:
To report on these services, Tanzu CloudHealth requires additional access to your Azure cloud.
Tanzu CloudHealth accesses only metadata. No sensitive data is accessed or collected.
To allow Tanzu CloudHealth to collect required metadata for the CIS Azure Foundations policy, assign a reader role to your Tanzu CloudHealth service principal’s active directory users.
Tanzu CloudHealth requires access to your Azure key vault keys and secret metadata to check whether your Azure cloud is compliant with CIS benchmarks.
$subs = Get-AzureRmSubscription
$client_id = 'client id of service principal'
foreach ($sub in $subs) {Set-AzureRmContext -SubscriptionId $sub.SubscriptionId
$key_vaults = Get-AzureRmKeyVault
foreach ($key_vault in $key_vaults) {Set-AzureRmKeyVaultAccessPolicy -VaultName $key_vault.VaultName -ServicePrincipalName $client_id -PermissionsToKeys get,list -PermissionsToSecrets get,list } }
client id of service principal
with your Azure service principal client ID. You can locate your client ID in the Tanzu CloudHealth Platform by going to Setup > Accounts > Azure Service Principal.A policy contains one or more policy blocks, each containing a specific rule that checks for compliance against an Azure CIS benchmark.
Switch the Status to Enabled and click Save Policy.
When you enable the CIS Azure Foundations policy, all rules within it are enabled and assigned a default severity. Recommendations from monitoring based on the CIS Azure Foundations policy are available within an hour. Recommendations appear daily.
Recommendations from the CIS Azure Foundations policy help you understand what the particular security issue is and what action you can take to address it. These recommendations are also visible in the Health Check Pulse Report.
If you want to customize the Azure CIS Foundations policy, you can edit the policy within certain constraints. Alternatively, you can modify a copy of the policy. In that case, however, the copy you create will not be updated when Tanzu CloudHealth adds CIS benchmarks to the default policy.
When you enable the Azure CIS Foundations policy, it only checks for security vulnerabilities in the top-level organization. In order to apply the policy to sub-organizations, duplicate the policy and specify the sub-organization to which it should apply.
In the dialog box that appears, name the duplicate policy and select the sub-organization to which it should apply.
Actions that you added to the original policy are not copied into the sub-organization.