Skip to main content

Harness Policy As Code for Services using Scorecards

Introduction

Harness provides governance using Open Policy Agent (OPA), Policy Management, and Rego policies.

In this tutorial we will look into how you can create the policy and apply it to all Services in your Account. The policy is evaluated on Service-level based on the score fetched from scorecards and the conditions set by users, and applues on pipeline-event like On Save which occurs during Connector Creation and Updates. Go to Harness Governance Quickstart.

Get Statred

  1. Go to Account Setting under Administrative Settings.

  1. Select Policies under Security and Governance.

  1. Now go to the Policies tab and select +New Policy.

  1. Add a name to your policy and then select Apply.

  1. Now from the Library select IDP Scorecard and select Use this Sample. Presently we have two Policies available for IDP, read more about it in the detailed docs.

  1. Now test and save it.

Create a Policy Set

  1. Now go to Policy Sets and create a +New Policy Set.
  2. Add a Name and Entity it applies to followed by the event it should be evaluated.

  1. Now add the policy you have created above and change the type to Warn & Continue and Apply.

  1. Now finish the step and an Policy Set would be created with Account Level Scope.

Conclusion

You have set-up a policy which can be used in your Deployment Pipeline.