Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
d928be7
solutions module
eriqua Jun 8, 2022
1c96b31
rke settings
eriqua Jun 8, 2022
40289a3
workflow
eriqua Jun 8, 2022
8976890
skip validation
eriqua Jun 8, 2022
df46d20
law and automation account
eriqua Jun 8, 2022
f4eb712
readme
eriqua Jun 8, 2022
964358b
law and automation account skip pester
eriqua Jun 8, 2022
d60d13d
ado
eriqua Jun 8, 2022
fcb0242
Merge branch 'main' of https://github.com/Azure/ResourceModules
eriqua Jun 8, 2022
3073190
enable pester
eriqua Jun 8, 2022
b41c970
fix static val location
eriqua Jun 8, 2022
d900fb3
carml tokens
eriqua Jun 8, 2022
9c198ba
fix input
eriqua Jun 8, 2022
555b9ea
rke
eriqua Jun 8, 2022
27651f4
carml
eriqua Jun 8, 2022
07303eb
disabling telemetry
eriqua Jun 8, 2022
20760e1
gallery param
eriqua Jun 8, 2022
17b13cb
telemetry
eriqua Jun 8, 2022
6647423
readme note
eriqua Jun 8, 2022
63ba035
merge main
eriqua Jun 8, 2022
b2f5b57
enableReferencedModulesTelemetry
eriqua Jun 8, 2022
d80e5fb
ado pipeline trigger
eriqua Jun 8, 2022
097577e
ado pipeline min par
eriqua Jun 8, 2022
e4b85e3
third party
eriqua Jun 8, 2022
cf2a042
third party param
eriqua Jun 8, 2022
676fe52
disable test
eriqua Jun 8, 2022
0dd6f95
test third party
eriqua Jun 8, 2022
aed9b34
Merge pull request #3 from eriqua/users/erikag/solutions
eriqua Jun 8, 2022
d134551
workspace readme
eriqua Jun 8, 2022
697d3d1
Merge branch 'main' of https://github.com/eriqua/ResourceModules
eriqua Jun 8, 2022
bec0582
carml
eriqua Jun 8, 2022
c2526cb
rke
eriqua Jun 10, 2022
fe38662
acr
eriqua Jun 10, 2022
262d297
Merge pull request #4 from eriqua/use3rs/erikag/sol
eriqua Jun 10, 2022
2ba6715
readme
eriqua Jun 10, 2022
55dd628
carml
eriqua Jun 10, 2022
6caf58b
Merge branch 'main' of https://github.com/Azure/ResourceModules
eriqua Jun 16, 2022
ea25413
lock 0.1
eriqua Jun 16, 2022
ca0fdad
rke
eriqua Jun 16, 2022
aea153f
skip pester
eriqua Jun 16, 2022
24dad16
testrg02
eriqua Jun 17, 2022
30dc763
test from rg module
eriqua Jun 17, 2022
664dd38
publish
eriqua Jun 17, 2022
0c2c36c
validation
eriqua Jun 17, 2022
2ca53d6
validation new line
eriqua Jun 17, 2022
6715436
ado
eriqua Jun 17, 2022
424c684
scope
eriqua Jun 17, 2022
7d504f3
location
eriqua Jun 17, 2022
f6aca2a
update lock name
eriqua Jun 17, 2022
41ce2e0
carml
eriqua Jun 17, 2022
8ddab8a
lock rg dependencies
eriqua Jun 17, 2022
b928ec3
lock rg dependencies in pipeline
eriqua Jun 17, 2022
f90c407
carml
eriqua Jun 17, 2022
1c7e308
subscription lock
eriqua Jun 20, 2022
6de4305
sub locks
eriqua Jun 20, 2022
d715fda
Merge branch 'Azure:main' into main
eriqua Jun 20, 2022
808f594
no name
eriqua Jun 20, 2022
1b407aa
disable sub level lock deployment
eriqua Jun 20, 2022
6ce1398
enable sub level lock deployment
eriqua Jun 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .azuredevops/modulePipelines/ms.authorization.locks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: 'Authorization - Locks'

parameters:
- name: removeDeployment
displayName: Remove deployed module
type: boolean
default: true
- name: prerelease
displayName: Publish prerelease module
type: boolean
default: false

pr: none

trigger:
batch: true
branches:
include:
- main
paths:
include:
- '/.azuredevops/modulePipelines/ms.authorization.locks.yml'
- '/.azuredevops/pipelineTemplates/*.yml'
- '/arm/Microsoft.Authorization/locks/*'
- '/arm/.global/global.module.tests.ps1'
exclude:
- '/**/*.md'

variables:
- template: '../../global.variables.yml'
- group: 'PLATFORM_VARIABLES'
- name: modulePath
value: '/arm/Microsoft.Authorization/locks'

stages:
- stage: Validation
displayName: Static validation
jobs:
- template: /.azuredevops/pipelineTemplates/jobs.validateModulePester.yml

- stage: Deployment
displayName: Deployment validation
jobs:
- template: /.azuredevops/pipelineTemplates/jobs.validateModuleDeployment.yml
parameters:
removeDeployment: '${{ parameters.removeDeployment }}'
deploymentBlocks:
- path: $(modulePath)/.parameters/rg.parameters.json
templateFilePath: $(modulePath)/deploy.bicep

- stage: Publishing
displayName: Publishing
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq('${{ parameters.prerelease }}', 'true')))
jobs:
- template: /.azuredevops/pipelineTemplates/jobs.publishModule.yml
3 changes: 3 additions & 0 deletions .azuredevops/platformPipelines/platform.dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ stages:
- path: $(dependencyPath)/$(resourceType)/parameters/validation.parameters.json
templateFilePath: $(templateFilePath)
displayName: Validation Resource Group
- path: $(dependencyPath)/$(resourceType)/parameters/locks.parameters.json
templateFilePath: $(templateFilePath)
displayName: Locks Resource Group

- stage: deploy_ppg
displayName: Deploy proximity placement group
Expand Down
145 changes: 145 additions & 0 deletions .github/workflows/ms.authorization.locks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: 'Authorization: Locks'

on:
workflow_dispatch:
inputs:
removeDeployment:
type: boolean
description: 'Remove deployed module'
required: false
default: true
prerelease:
type: boolean
description: 'Publish prerelease module'
required: false
default: false
push:
branches:
- main
paths:
- '.github/actions/templates/**'
- '.github/workflows/ms.authorization.locks.yml'
- 'arm/Microsoft.Authorization/locks/**'
- 'arm/.global/global.module.tests.ps1'
- '!*/**/readme.md'
- 'utilities/pipelines/**'
- '!utilities/pipelines/dependencies/**'

env:
variablesPath: 'global.variables.yml'
modulePath: 'arm/Microsoft.Authorization/locks'
workflowPath: '.github/workflows/ms.authorization.locks.yml'
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
ARM_SUBSCRIPTION_ID: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
ARM_MGMTGROUP_ID: '${{ secrets.ARM_MGMTGROUP_ID }}'
ARM_TENANT_ID: '${{ secrets.ARM_TENANT_ID }}'
DEPLOYMENT_SP_ID: '${{ secrets.DEPLOYMENT_SP_ID }}'

jobs:
###########################
# Initialize pipeline #
###########################
job_initialize_pipeline:
runs-on: ubuntu-20.04
name: 'Initialize pipeline'
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Set input parameters to output variables'
id: get-workflow-param
uses: ./.github/actions/templates/getWorkflowInput
with:
workflowPath: '${{ env.workflowPath}}'
- name: 'Get parameter file paths'
id: get-parameter-file-paths
uses: ./.github/actions/templates/getParameterFiles
with:
modulePath: '${{ env.modulePath }}'
outputs:
removeDeployment: ${{ steps.get-workflow-param.outputs.removeDeployment }}
parameterFilePaths: ${{ steps.get-parameter-file-paths.outputs.parameterFilePaths }}

#########################
# Static validation #
#########################
job_module_pester_validation:
runs-on: ubuntu-20.04
name: 'Static validation'
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Run tests'
uses: ./.github/actions/templates/validateModulePester
with:
modulePath: '${{ env.modulePath }}'

#############################
# Deployment validation #
#############################
job_module_deploy_validation:
runs-on: ubuntu-20.04
name: 'Deployment validation'
needs:
- job_initialize_pipeline
- job_module_pester_validation
strategy:
fail-fast: false
matrix:
parameterFilePaths: ${{ fromJSON(needs.job_initialize_pipeline.outputs.parameterFilePaths) }}
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set environment variables
uses: ./.github/actions/templates/setEnvironmentVariables
with:
variablesPath: ${{ env.variablesPath }}
# ------------------- #
## Deploy & Remove ##
# ------------------- #
- name: 'Using parameter file [${{ matrix.parameterFilePaths }}]'
uses: ./.github/actions/templates/validateModuleDeployment
with:
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
parameterFilePath: '${{ env.modulePath }}/${{ matrix.parameterFilePaths }}'
location: '${{ env.location }}'
resourceGroupName: '${{ env.resourceGroupName }}'
subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}'
removeDeployment: '${{ needs.job_initialize_pipeline.outputs.removeDeployment }}'

##################
# Publishing #
##################
job_publish_module:
name: 'Publishing'
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.event.inputs.prerelease == 'true'
runs-on: ubuntu-20.04
needs:
- job_module_deploy_validation
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set environment variables
uses: ./.github/actions/templates/setEnvironmentVariables
with:
variablesPath: ${{ env.variablesPath }}
- name: 'Publishing'
uses: ./.github/actions/templates/publishModule
with:
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
templateSpecsRGName: '${{ env.templateSpecsRGName }}'
templateSpecsRGLocation: '${{ env.templateSpecsRGLocation }}'
templateSpecsDescription: '${{ env.templateSpecsDescription }}'
templateSpecsDoPublish: '${{ env.templateSpecsDoPublish }}'
bicepRegistryName: '${{ env.bicepRegistryName }}'
bicepRegistryRGName: '${{ env.bicepRegistryRGName }}'
bicepRegistryRgLocation: '${{ env.bicepRegistryRgLocation }}'
bicepRegistryDoPublish: '${{ env.bicepRegistryDoPublish }}'
3 changes: 1 addition & 2 deletions .github/workflows/platform.dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ jobs:
strategy:
fail-fast: false
matrix:
parameterFilePaths: ['validation.parameters.json']
parameterFilePaths: ['validation.parameters.json', 'locks.parameters.json']
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: 'Deploy module'
uses: ./.github/actions/templates/validateModuleDeployment
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"level": {
"value": "CanNotDelete"
},
"resourceGroupName": {
"value": "adp-<<namePrefix>>-az-locks-rg-001"
},
"subscriptionId": {
"value": "<<subscriptionId>>"
}
}
}
69 changes: 69 additions & 0 deletions arm/Microsoft.Authorization/locks/deploy.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
targetScope = 'subscription'

@allowed([
'CanNotDelete'
'ReadOnly'
])
@description('Required. Set lock level.')
param level string

@description('Optional. The decription attached to the lock.')
param notes string = level == 'CanNotDelete' ? 'Cannot delete resource or child resources.' : 'Cannot modify the resource or child resources.'

@description('Optional. Enable telemetry via the Customer Usage Attribution ID (GUID).')
param enableDefaultTelemetry bool = true

@description('Optional. Name of the Resource Group to assign the lock to. If Resource Group name is provided, and Subscription ID is provided, the module deploys at resource group level, therefore assigns the provided lock to the resource group.')
param resourceGroupName string = ''

@description('Optional. Subscription ID of the subscription to assign the lock to. If not provided, will use the current scope for deployment. If no resource group name is provided, the module deploys at subscription level, therefore assigns the provided locks to the subscription.')
param subscriptionId string = subscription().id

@sys.description('Optional. Location for all resources.')
param location string = deployment().location

var enableReferencedModulesTelemetry = false

resource defaultTelemetry 'Microsoft.Resources/deployments@2021-04-01' = if (enableDefaultTelemetry) {
name: 'pid-47ed15a6-730a-4827-bcb4-0fd963ffbd82-${uniqueString(deployment().name, location)}'
location: location
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
resources: []
}
}
}

module lock_sub 'subscription/deploy.bicep' = if (!empty(subscriptionId) && empty(resourceGroupName)) {
name: '${uniqueString(deployment().name, location)}-Lock-Sub-Module'
scope: subscription(subscriptionId)
params: {
name: '${subscription().displayName}-${level}-lock'
level: level
notes: notes
enableDefaultTelemetry: enableReferencedModulesTelemetry
}
}

module lock_rg 'resourceGroup/deploy.bicep' = if (!empty(subscriptionId) && !empty(resourceGroupName)) {
name: '${uniqueString(deployment().name, location)}-Lock-RG-Module'
scope: resourceGroup(subscriptionId, resourceGroupName)
params: {
name: '${resourceGroupName}-${level}-lock'
level: level
notes: notes
enableDefaultTelemetry: enableReferencedModulesTelemetry
}
}

@description('The name of the lock.')
output name string = empty(resourceGroupName) ? lock_sub.outputs.name : lock_rg.outputs.name

@description('The resource ID of the lock.')
output resourceId string = empty(resourceGroupName) ? lock_sub.outputs.resourceId : lock_rg.outputs.resourceId

@sys.description('The scope this lock applies to.')
output scope string = empty(resourceGroupName) ? subscription().id : any(resourceGroup(resourceGroupName))
Loading