/AzurePolicy

Run Azure Policy in On-premises environment

Primary LanguageC#MIT LicenseMIT

AzurePolicy

Run Azure Policy in On-premises environment

About Azure Policy

https://docs.microsoft.com/en-us/azure/governance/policy/

Quick start:

Configuration

  1. Using PolicyService
services.UsingPolicyService();
  1. Add On-premises support
services.AddSingleton<IInfrastructure,MockInfrastructure>();
  1. Add ARMOrchestrationService

More information reference: https://github.com/maskx/ARMOrchestration

var sqlConfig = new ARMOrchestrationSqlServerConfig()
    {
        Database = new DatabaseConfig()
        {
            ConnectionString = TestHelper.ConnectionString,
            AutoCreate = true
        }
    };
 services.UsingARMOrchestration(sqlConfig);
 services.AddSingleton<maskx.ARMOrchestration.IInfrastructure>((sp) =>
 {
     return new MockARMInfrastructure(sp);
 });

Validate

Before start ARMOrchestration, run

var result=PolicyService.Validate(new DeploymentOrchestrationInput());

Audit

In a background servcie, run:

PolicyService.Audit("Audit scope");

Remedy

Not support yet

IInfrastructure

GetPolicyDefinitions

GetPolicyInitiatives

Audit

GetResourcesByScope

ResourceIsExisting

Deploy