Skip to content

Instantly share code, notes, and snippets.

View goyalmohit's full-sized avatar

mohit goyal goyalmohit

View GitHub Profile
provider "azuredevops" {
version = ">= 0.0.1"
}
resource "azuredevops_project" "tf-example" {
project_name = "tf-example"
description = "Project deployed using Terraform"
version_control = "git"
visibility = "private"
work_item_template = "Agile"
# incomplete block - will not work
resource "azuredevops_project_features" "tf-example-features" {
features = {
"boards" = "enabled"
"repositories" = "enabled"
"pipelines" = "enabled"
"testplans" = "disabled"
"artifacts" = "enabled"
}
}
provider "azuredevops" {
version = ">= 0.0.1"
}
resource "azuredevops_project" "tf-example" {
project_name = "tf-example"
description = "Project deployed using Terraform"
version_control = "git"
visibility = "private"
work_item_template = "Agile"
provider "azuredevops" {
version = ">= 0.0.1"
}
resource "azuredevops_project" "tf-example" {
project_name = "tf-example"
description = "Project deployed using Terraform"
version_control = "git"
visibility = "private"
work_item_template = "Agile"
provider "azuredevops" {
version = ">= 0.0.1"
}
resource "azuredevops_project" "tf-example" {
project_name = "tf-example"
description = "Project deployed using Terraform"
}
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountType": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
# Login into Azure Account
Connect-AzAccount
# Import Policy definition from GitHub
$definition = New-AzPolicyDefinition -Name "audit-resourceGroup-tags" -DisplayName "Audit resource groups missing tags" -Description "Audit resource groups that doesn't have particular tag" -Policy 'https://raw.githubusercontent.com/Azure/azure-policy/master/samples/ResourceGroup/audit-resourceGroup-tags/azurepolicy.rules.json' -Parameter 'https://raw.githubusercontent.com/Azure/azure-policy/master/samples/ResourceGroup/audit-resourceGroup-tags/azurepolicy.parameters.json' -Mode All
# Defining Policy Scope
$scope = '/subscriptions/{subscription-id}'
# Create Assignment for the policy
{
"policyRule": {
"if": {
"allOf": [
{
"field": "location",
"notIn": [ "eastus", "eastus2", "westus", "westus2" ]
},
{
"field": "location",
@goyalmohit
goyalmohit / restrict-azure-locations.json
Created September 28, 2019 09:33
Built-In Azure Policy to restrict azure locations
{
"properties": {
"displayName": "Allowed locations",
"policyType": "BuiltIn",
"description": "This policy enables you to restrict the locations your organization can specify when deploying resources. Use to enforce your geo-compliance requirements. Excludes resource groups, Microsoft.AzureActiveDirectory/b2cDirectories, and resources that use the 'global' region.",
"mode": "Indexed",
"parameters": {
"listOfAllowedLocations": {
"type": "Array",
"metadata": {
@goyalmohit
goyalmohit / azure-pipelines-section.yml
Created August 14, 2019 03:03
Bash task to run liquibase commands during release process
..
- task: Bash@3
inputs:
targetType: 'inline'
script: |
cd $(System.ArtifactsDirectory)
unzip ./drop/liquibase-demo.zip -d liquibase-demo
cd ./liquibase-demo
java -jar ./lib/liquibase-core-3.3.0.jar --defaultsFile=./src/main/resources/liquibase.properties update
..