Giter Site home page Giter Site logo

azure-policy-samples's People

Contributors

edonkor1 avatar noelbundick avatar stefangordon avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

nicoli10

azure-policy-samples's Issues

Experiment with Functional Test process for Azure Policy

Basic python script to verify a policy definition. Perhaps it identifies the associated "assignments" and positive/negative templates to the definition and then tests them and verifies they succeed/fail as expected?

Likely outcome of this is not just a POC script, but some ideas on the best way to approach this, or if there is some other tooling/framework that would make it cleaner.

Identify Delta between Source Control and Azure

This isn't thought out all the way yet!

We need to have some concept of querying the list of definitions/assignments from the API and comparing that to our list in source control. (Presumably a pre-req is a bit of code to generate a list of definitions and assignments from a folder which is used here, along with looped over for deployments, tests, etc).

For instance we could just blindly create or update everything, but what if something was deleted from source control, how would we know to go delete it from the subscription?

Also, just as an engineer, being able to print out or report on the delta seems like an important thing.

Script to Deploy Custom Policy Definition

Format as simple executable python3 script for now, e.g. #!/usr/bin/env python3

Deploy full form custom policy JSON (like the ones in this repo) to a specified scope (subscription or management group).

I'd just assume service principal auth for env variables for everything for now, e.g.

            credentials = ServicePrincipalCredentials(
                client_id=os.environ[constants.ENV_CLIENT_ID],
                secret=os.environ[constants.ENV_CLIENT_SECRET],
                tenant=os.environ[constants.ENV_TENANT_ID],
                resource='https://management.core.windows.net/')

where

ENV_TENANT_ID = 'AZURE_TENANT_ID'
ENV_CLIENT_ID = 'AZURE_CLIENT_ID'
ENV_CLIENT_SECRET = 'AZURE_CLIENT_SECRET'

Script to Create Policy Assignment

Format as simple executable python3 script for now, e.g. #!/usr/bin/env python3

Should allow assigning a policy to a scope. Could be a CUSTOM or a BUILTIN policy definition assigned to scope of subscription, management group, or resource group.

Depends on #3

I'd just assume service principal auth for env variables for everything for now, e.g.

            credentials = ServicePrincipalCredentials(
                client_id=os.environ[constants.ENV_CLIENT_ID],
                secret=os.environ[constants.ENV_CLIENT_SECRET],
                tenant=os.environ[constants.ENV_TENANT_ID],
                resource='https://management.core.windows.net/')

where

ENV_TENANT_ID = 'AZURE_TENANT_ID'
ENV_CLIENT_ID = 'AZURE_CLIENT_ID'
ENV_CLIENT_SECRET = 'AZURE_CLIENT_SECRET'

Sample Policy Assignment Artifacts

Define some artifacts that represent policy assignments (is the right way to do it with an ARM template that is parameterized perhaps?)

This will unblock #2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.