Skip to content

Latest commit

 

History

History
91 lines (59 loc) · 4.94 KB

signalr-howto-azure-policy.md

File metadata and controls

91 lines (59 loc) · 4.94 KB
titledescriptionauthorms.servicems.topicms.datems.author
Compliance using Azure Policy
Assign built-in policies in Azure Policy to audit compliance of your Azure SignalR Service resources.
vicancy
azure-signalr-service
how-to
07/18/2022
lianwei

Audit compliance of Azure SignalR Service resources using Azure Policy

Azure Policy is a service in Azure that you use to create, assign, and manage policies. These policies enforce different rules and effects over your resources, so those resources stay compliant with your corporate standards and service level agreements.

This article introduces built-in policies (preview) for Azure SignalR Service. Use these policies to audit new and existing SignalR resources for compliance.

There are no charges for using Azure Policy.

Built-in policy definitions

The following built-in policy definitions are specific to Azure SignalR Service:

[!INCLUDE azure-policy-reference-policies-signalr]

Assign policy definitions

Note

After you assign or update a policy, it takes some time for the assignment to be applied to resources in the defined scope. See information about policy evaluation triggers.

Review policy compliance

Access compliance information generated by your policy assignments using the Azure portal, Azure command-line tools, or the Azure Policy SDKs. For details, see Get compliance data of Azure resources.

When a resource is non-compliant, there are many possible reasons. To determine the reason or to find the change responsible, see Determine non-compliance.

Policy compliance in the portal:

  1. Select All services, and search for Policy.

  2. Select Compliance.

  3. Use the filters to limit compliance states or to search for policies

    Screenshot showing policy compliance in portal.

  4. Select a policy to review aggregate compliance details and events. If desired, then select a specific SignalR for resource compliance.

Policy compliance in the Azure CLI

You can also use the Azure CLI to get compliance data. For example, use the az policy assignment list command in the CLI to get the policy IDs of the Azure SignalR Service policies that are applied:

az policy assignment list --query "[?contains(displayName,'SignalR')].{name:displayName, ID:id}" --output table 

Sample output:

Name ID ------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- [Preview]: Azure SignalR Service should use private links /subscriptions/<subscriptionId>/resourceGroups/<resourceGroup>/providers/Microsoft.Authorization/policyAssignments/<assignmentId> 

Then run az policy state list to return the JSON-formatted compliance state for all resources under a specific resource group:

az policy state list --g <resourceGroup> 

Or run az policy state list to return the JSON-formatted compliance state of a specific SignalR resource:

az policy state list \ --resource /subscriptions/<subscriptionId>/resourceGroups/<resourceGroup>/providers/Microsoft.SignalRService/SignalR/<resourceName> \ --namespace Microsoft.SignalRService \ --resource-group <resourceGroup> 

Next steps

close