Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8f79958
[MAJOR/BREAKING] Renamed `arm` to `modules` (#1498)
Jun 25, 2022
00272aa
Merge branch 'main' of https://github.com/Azure/ResourceModules into …
MariusStorhaug Jun 26, 2022
27e87c1
Updated readme
AlexanderSehr Jun 26, 2022
60ec109
Updated readme
AlexanderSehr Jun 26, 2022
3c60701
Minor update
AlexanderSehr Jun 26, 2022
cd82aac
Added trigger to arm convertion test
AlexanderSehr Jun 26, 2022
1bcc7ed
Adjusted pester
AlexanderSehr Jun 26, 2022
9832be2
Fixed in readme function
AlexanderSehr Jun 26, 2022
c5e4457
Re-added deleted template
AlexanderSehr Jun 26, 2022
69cad60
Fixed pipeline reference
AlexanderSehr Jun 27, 2022
436f8bb
Fixed pipeline reference
AlexanderSehr Jun 27, 2022
fda28c2
Fixed pipeline title
AlexanderSehr Jun 27, 2022
930e1b0
Merge branch 'main' into issue/1127
AlexanderSehr Jun 27, 2022
80ba15b
Fixed another typo
AlexanderSehr Jun 27, 2022
7a21350
Fixed another typo
AlexanderSehr Jun 27, 2022
908a8ab
Fixed casing
AlexanderSehr Jun 27, 2022
b7cee57
Fixed service fabric pipeline reference
AlexanderSehr Jun 27, 2022
a2571f0
First batch of changes
AlexanderSehr Jun 27, 2022
a2681cc
Further renames
AlexanderSehr Jun 27, 2022
aa43dfa
Updated parameter fetch function
AlexanderSehr Jun 27, 2022
58cddcd
Updated docs
AlexanderSehr Jun 27, 2022
c8d4423
Further rename
AlexanderSehr Jun 27, 2022
0a33114
First commit
AlexanderSehr Jun 27, 2022
6f1c940
[Modules] Redis cache module (#1582)
itpropro Jul 4, 2022
809b34c
Moved folder
AlexanderSehr Jul 4, 2022
a6ba765
Merged latst main
AlexanderSehr Jul 4, 2022
deb469a
Updated pipeline
AlexanderSehr Jul 4, 2022
435b0db
Update to latest
AlexanderSehr Jul 4, 2022
e58de3e
Updated readm
AlexanderSehr Jul 4, 2022
a6fc76e
Updated template
AlexanderSehr Jul 4, 2022
ed03fa3
Updated readme
AlexanderSehr Jul 4, 2022
a8c7d7a
pdated default
AlexanderSehr Jul 4, 2022
5157f35
Updated output
AlexanderSehr Jul 4, 2022
fcf159e
Formatted roles
AlexanderSehr Jul 11, 2022
aa84ada
Update modules/Microsoft.Cache/redis/deploy.bicep
AlexanderSehr Jul 11, 2022
853a25e
Update modules/Microsoft.Cache/redis/deploy.bicep
AlexanderSehr Jul 11, 2022
7a8de2e
Renamed param
AlexanderSehr Jul 11, 2022
42a8cfa
Added private endpoints
AlexanderSehr Jul 11, 2022
8ec4eb1
Switched to basic sku
AlexanderSehr Jul 11, 2022
8545482
Adjusted family property
AlexanderSehr Jul 11, 2022
5f8bf49
Refactored family parameter
AlexanderSehr Jul 11, 2022
6e5557c
Update modules/Microsoft.Cache/redis/deploy.bicep
AlexanderSehr Jul 11, 2022
be76c10
Updated desc
AlexanderSehr Jul 11, 2022
197b8e8
Merge branch 'users/itpropro/redis' of https://github.com/Azure/Resou…
AlexanderSehr Jul 11, 2022
cab439b
Updated docs
AlexanderSehr Jul 11, 2022
8049008
Updated rbac roles
AlexanderSehr Jul 11, 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
57 changes: 57 additions & 0 deletions .azuredevops/modulePipelines/ms.cache.redis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 'Cache - Redis'

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.cache.redis.yml'
- '/.azuredevops/pipelineTemplates/*.yml'
- '/modules/Microsoft.Cache/Redis/*'
- '/modules/.global/global.module.tests.ps1'
- '/utilities/pipelines/*'
exclude:
- '/utilities/pipelines/dependencies/*'
- '/**/*.md'

variables:
- template: '../../global.variables.yml'
- group: 'PLATFORM_VARIABLES'
- name: modulePath
value: '/modules/Microsoft.Cache/redis'

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)/.test/min.parameters.json
- path: $(modulePath)/.test/parameters.json

- 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
142 changes: 142 additions & 0 deletions .github/workflows/ms.cache.redis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: 'Cache: Redis'

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.cache.redis.yml'
- 'modules/Microsoft.Cache/redis/**'
- 'modules/.global/global.module.tests.ps1'
- '!*/**/readme.md'
- 'utilities/pipelines/**'
- '!utilities/pipelines/dependencies/**'

env:
variablesPath: 'global.variables.yml'
modulePath: 'modules/Microsoft.Cache/redis'
workflowPath: '.github/workflows/ms.cache.redis.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 }}
- 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 }}'
54 changes: 54 additions & 0 deletions modules/Microsoft.Cache/redis/.bicep/nested_rbac.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
@sys.description('Required. The IDs of the principals to assign the role to.')
param principalIds array

@sys.description('Required. The name of the role to assign. If it cannot be found you can specify the role definition ID instead.')
param roleDefinitionIdOrName string

@sys.description('Required. The resource ID of the resource to apply the role assignment to.')
param resourceId string

@sys.description('Optional. The principal type of the assigned principal ID.')
@allowed([
'ServicePrincipal'
'Group'
'User'
'ForeignGroup'
'Device'
''
])
param principalType string = ''

@sys.description('Optional. The description of the role assignment.')
param description string = ''

var builtInRoleNames = {
'Owner': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')
'Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')
'Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'acdd72a7-3385-48ef-bd42-f606fba81ae7')
'Log Analytics Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '92aaf0da-9dab-42b6-94a3-d43ce8d16293')
'Log Analytics Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '73c42c96-874c-492b-b04d-ab87d138a893')
'Managed Application Contributor Role': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '641177b8-a67a-45b9-a033-47bc880bb21e')
'Managed Application Operator Role': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'c7393b34-138c-406f-901b-d8cf2b17e6ae')
'Managed Applications Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b9331d33-8a36-4f8c-b097-4f54124fdb44')
'Monitoring Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '749f88d5-cbae-40b8-bcfc-e573ddc772fa')
'Monitoring Metrics Publisher': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '3913510d-42f4-4e42-8a64-420c390055eb')
'Monitoring Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '43d0d8ad-25c7-4714-9337-8ba259a9fe05')
'Redis Cache Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'e0f68234-74aa-48ed-b826-c38b57376e17')
'Resource Policy Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '36243c78-bf99-498c-9df9-86d9f8d28608')
'User Access Administrator': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '18d7d88d-d35e-4fb5-a5c3-7773c20a72d9')
}

resource redisCache 'Microsoft.Cache/redis@2021-06-01' existing = {
name: last(split(resourceId, '/'))
}

resource roleAssignment 'Microsoft.Authorization/roleAssignments@2020-10-01-preview' = [for principalId in principalIds: {
name: guid(redisCache.id, principalId, roleDefinitionIdOrName)
properties: {
description: description
roleDefinitionId: contains(builtInRoleNames, roleDefinitionIdOrName) ? builtInRoleNames[roleDefinitionIdOrName] : roleDefinitionIdOrName
principalId: principalId
principalType: !empty(principalType) ? any(principalType) : null
}
scope: redisCache
}]
9 changes: 9 additions & 0 deletions modules/Microsoft.Cache/redis/.test/min.parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "<<namePrefix>>-az-redis-min-001"
}
}
}
63 changes: 63 additions & 0 deletions modules/Microsoft.Cache/redis/.test/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "<<namePrefix>>-az-redis-full-001"
},
"capacity": {
"value": 2
},
"diagnosticLogCategoriesToEnable": {
"value": [
"ApplicationGatewayAccessLog",
"ApplicationGatewayFirewallLog"
]
},
"diagnosticMetricsToEnable": {
"value": [
"AllMetrics"
]
},
"enableNonSslPort": {
"value": true
},
"lock": {
"value": "CanNotDelete"
},
"minimumTlsVersion": {
"value": "1.2"
},
"diagnosticSettingsName": {
"value": "redisdiagnostics"
},
"publicNetworkAccess": {
"value": "Enabled"
},
"redisVersion": {
"value": "6"
},
"skuName": {
"value": "Premium"
},
"systemAssignedIdentity": {
"value": true
},
"shardCount": {
"value": 1
},
"tags": {
"value": {
"resourceType": "Redis Cache"
}
},
"privateEndpoints": {
"value": [
{
"subnetResourceId": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<<namePrefix>>-az-vnet-x-001/subnets/<<namePrefix>>-az-subnet-x-005-privateEndpoints",
"service": "redisCache"
}
]
}
}
}
Loading