Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
3a9b798
purview account module
tyconsulting Feb 3, 2023
988728f
add github action for purview
tyconsulting Feb 3, 2023
72b35bb
Merge pull request #1 from TY-Consulting/feature/purview
tyconsulting Feb 3, 2023
201965b
add
tyconsulting Feb 3, 2023
0ec4548
update
tyconsulting Feb 3, 2023
da06823
update readme
tyconsulting Feb 3, 2023
2c60a3d
update
tyconsulting Feb 3, 2023
bdab25f
update readme
tyconsulting Feb 3, 2023
1c86f63
add
tyconsulting Feb 3, 2023
2e628d3
update readme
tyconsulting Feb 3, 2023
110af53
update
tyconsulting Feb 5, 2023
3a34cc8
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 5, 2023
45086ae
update built-in roles
tyconsulting Feb 5, 2023
059e899
update
tyconsulting Feb 5, 2023
03fe483
Update modules/Microsoft.Purview/accounts/.test/common/deploy.test.bicep
tyconsulting Feb 5, 2023
290dd96
Update modules/Microsoft.Purview/accounts/.test/min/deploy.test.bicep
tyconsulting Feb 5, 2023
ff50100
Update modules/Microsoft.Purview/accounts/.test/common/deploy.test.bicep
tyconsulting Feb 5, 2023
ee5c44a
Update modules/Microsoft.Purview/accounts/.test/common/deploy.test.bicep
tyconsulting Feb 5, 2023
e7c1887
Update modules/Microsoft.Purview/accounts/.test/common/deploy.test.bicep
tyconsulting Feb 5, 2023
73b677e
update
tyconsulting Feb 5, 2023
9718305
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 5, 2023
743bbe9
Update modules/Microsoft.Purview/accounts/.test/common/deploy.test.bicep
tyconsulting Feb 5, 2023
a672a52
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 5, 2023
e1ae14d
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 5, 2023
7c2f2da
update
tyconsulting Feb 5, 2023
36de801
update
tyconsulting Feb 5, 2023
af5d34e
update
tyconsulting Feb 5, 2023
ba61d80
update
tyconsulting Feb 5, 2023
8d40a54
Merge branch 'Azure:main' into fix/purview
tyconsulting Feb 5, 2023
a5b2fd0
update github action yaml
tyconsulting Feb 5, 2023
dcce9aa
update
tyconsulting Feb 5, 2023
7afd739
update
tyconsulting Feb 5, 2023
b0dd8ab
update
tyconsulting Feb 5, 2023
5edb4d7
update
tyconsulting Feb 5, 2023
39454be
update
tyconsulting Feb 5, 2023
05e8433
fix
tyconsulting Feb 5, 2023
424f7f4
update
tyconsulting Feb 5, 2023
193f7f7
fix
tyconsulting Feb 5, 2023
4ba4888
fix
taoyangmvp Feb 5, 2023
36216e2
updated readme
taoyangmvp Feb 5, 2023
4cc7e68
Update modules/Microsoft.Purview/accounts/.test/common/dependencies.b…
tyconsulting Feb 6, 2023
01f3bc6
Update modules/Microsoft.Purview/accounts/.test/common/deploy.test.bicep
tyconsulting Feb 6, 2023
f669fa7
Update modules/Microsoft.Purview/accounts/.test/common/deploy.test.bicep
tyconsulting Feb 6, 2023
e24b7da
Update modules/Microsoft.Purview/accounts/.test/common/deploy.test.bicep
tyconsulting Feb 6, 2023
cbf3113
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
6e3b268
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
d356fd3
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
55b6c03
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
c22263f
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
b2f788a
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
edff7f0
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
0b762d9
Update modules/Microsoft.Purview/accounts/.test/common/deploy.test.bicep
tyconsulting Feb 6, 2023
747d89e
Update modules/Microsoft.Purview/accounts/.test/common/deploy.test.bicep
tyconsulting Feb 6, 2023
b34730e
Update modules/Microsoft.Purview/accounts/.test/common/deploy.test.bicep
tyconsulting Feb 6, 2023
f52c588
Update modules/Microsoft.Purview/accounts/.test/common/deploy.test.bicep
tyconsulting Feb 6, 2023
5adb346
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
5814e8b
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
1f567be
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
792334f
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
ad68cf6
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
494bd0f
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
cb3eeaa
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
bcd94b0
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
cbeb96b
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
6abe49c
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
9d1af87
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
68a6a4d
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
9d68a14
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
cc3dcde
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
67e65e1
Update modules/Microsoft.Purview/accounts/deploy.bicep
tyconsulting Feb 6, 2023
9500d72
update
tyconsulting Feb 6, 2023
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
50 changes: 50 additions & 0 deletions .azuredevops/modulePipelines/ms.purview.accounts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'Purview - Accounts'

parameters:
- name: staticValidation
displayName: Execute static validation
type: boolean
default: true
- name: deploymentValidation
displayName: Execute deployment validation
type: boolean
default: true
- 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.purview.accounts.yml'
- '/.azuredevops/pipelineTemplates/*.yml'
- '/modules/Microsoft.Purview/accounts/*'
- '/utilities/pipelines/*'
exclude:
- '/utilities/pipelines/deploymentRemoval/*'
- '/**/*.md'

variables:
- template: '../../settings.yml'
- group: 'PLATFORM_VARIABLES'
- name: modulePath
value: '/modules/Microsoft.Purview/accounts'

stages:
- template: /.azuredevops/pipelineTemplates/stages.module.yml
parameters:
staticValidation: '${{ parameters.staticValidation }}'
deploymentValidation: '${{ parameters.deploymentValidation }}'
removeDeployment: '${{ parameters.removeDeployment }}'
prerelease: '${{ parameters.prerelease }}'
168 changes: 168 additions & 0 deletions .github/workflows/ms.purview.accounts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
name: 'Purview: Accounts'

on:
workflow_dispatch:
inputs:
staticValidation:
type: boolean
description: 'Execute static validation'
required: false
default: true
deploymentValidation:
type: boolean
description: 'Execute deployment validation'
required: false
default: true
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.purview.accounts.yml'
- 'modules/Microsoft.Purview/accounts/**'
- 'utilities/pipelines/**'
- '!utilities/pipelines/deploymentRemoval/**'
- '!*/**/readme.md'

env:
variablesPath: 'settings.yml'
modulePath: 'modules/Microsoft.Purview/accounts'
workflowPath: '.github/workflows/ms.purview.accounts.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 }}'
TOKEN_NAMEPREFIX: '${{ secrets.TOKEN_NAMEPREFIX }}'

concurrency:
group: ${{ github.workflow }}

jobs:
###########################
# Initialize pipeline #
###########################
job_initialize_pipeline:
runs-on: ubuntu-20.04
name: 'Initialize pipeline'
steps:
- name: 'Checkout'
uses: actions/checkout@v3
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-module-test-file-paths
uses: ./.github/actions/templates/getModuleTestFiles
with:
modulePath: '${{ env.modulePath }}'
outputs:
workflowInput: ${{ steps.get-workflow-param.outputs.workflowInput }}
moduleTestFilePaths: ${{ steps.get-module-test-file-paths.outputs.moduleTestFilePaths }}

#########################
# Static validation #
#########################
job_module_static_validation:
runs-on: ubuntu-20.04
name: 'Static validation'
if: (fromJson(needs.job_initialize_pipeline.outputs.workflowInput)).staticValidation == 'true'
needs:
- job_initialize_pipeline
steps:
- name: 'Checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set environment variables
uses: ./.github/actions/templates/setEnvironmentVariables
with:
variablesPath: ${{ env.variablesPath }}
- name: 'Run tests'
uses: ./.github/actions/templates/validateModulePester
with:
modulePath: '${{ env.modulePath }}'
moduleTestFilePath: '${{ env.moduleTestFilePath }}'

#############################
# Deployment validation #
#############################
job_module_deploy_validation:
runs-on: ubuntu-20.04
name: 'Deploying'
if: |
!cancelled() &&
(fromJson(needs.job_initialize_pipeline.outputs.workflowInput)).deploymentValidation == 'true' &&
needs.job_module_static_validation.result != 'failure'
needs:
- job_initialize_pipeline
- job_module_static_validation
strategy:
fail-fast: false
matrix:
moduleTestFilePaths: ${{ fromJson(needs.job_initialize_pipeline.outputs.moduleTestFilePaths) }}
steps:
- name: 'Checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set environment variables
uses: ./.github/actions/templates/setEnvironmentVariables
with:
variablesPath: ${{ env.variablesPath }}
# ------------------- #
## Deploy & Remove ##
# ------------------- #
- name: 'Using test file [${{ matrix.moduleTestFilePaths }}]'
uses: ./.github/actions/templates/validateModuleDeployment
with:
templateFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}'
location: '${{ env.location }}'
subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}'
removeDeployment: '${{ (fromJson(needs.job_initialize_pipeline.outputs.workflowInput)).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@v3
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 }}'
publishLatest: '${{ env.publishLatest }}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
@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 = ''

@sys.description('Optional. The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase "foo_storage_container".')
param condition string = ''

@sys.description('Optional. Version of the condition.')
@allowed([
'2.0'
])
param conditionVersion string = '2.0'

@sys.description('Optional. Id of the delegated managed identity resource.')
param delegatedManagedIdentityResourceId string = ''

var builtInRoleNames = {
Contributor: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')
'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 Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '43d0d8ad-25c7-4714-9337-8ba259a9fe05')
Owner: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')
'Purview role 1 (Deprecated)': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '8a3c2885-9b38-4fd2-9d99-91af537c1347')
'Purview role 2 (Deprecated)': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '200bba9e-f0c8-430f-892b-6f0794863803')
'Purview role 3 (Deprecated)': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ff100721-1b9d-43d8-af52-42b69c1272db')
Reader: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'acdd72a7-3385-48ef-bd42-f606fba81ae7')
'Resource Policy Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '36243c78-bf99-498c-9df9-86d9f8d28608')
'Role Based Access Control Administrator (Preview)': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'f58310d9-a9f6-439a-9e8d-f62e7b41a168')
'User Access Administrator': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '18d7d88d-d35e-4fb5-a5c3-7773c20a72d9')
}

resource purviewAccount 'Microsoft.Purview/accounts@2021-07-01' existing = {
name: last(split(resourceId, '/'))
}

resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = [for principalId in principalIds: {
name: guid(purviewAccount.id, principalId, roleDefinitionIdOrName)
properties: {
description: description
roleDefinitionId: contains(builtInRoleNames, roleDefinitionIdOrName) ? builtInRoleNames[roleDefinitionIdOrName] : roleDefinitionIdOrName
principalId: principalId
principalType: !empty(principalType) ? any(principalType) : null
condition: !empty(condition) ? condition : null
conditionVersion: !empty(conditionVersion) && !empty(condition) ? conditionVersion : null
delegatedManagedIdentityResourceId: !empty(delegatedManagedIdentityResourceId) ? delegatedManagedIdentityResourceId : null
}
scope: purviewAccount
}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@description('Optional. The location to deploy to.')
param location string = resourceGroup().location

@description('Required. The name of the Virtual Network to create.')
param virtualNetworkName string

@description('Required. The name of the Managed Identity to create.')
param managedIdentityName string

var addressPrefix = '10.0.0.0/16'

var privateDNSZoneNames = [
'privatelink.purview.azure.com'
'privatelink.purviewstudio.azure.com'
'privatelink.blob.core.windows.net'
'privatelink.queue.core.windows.net'
'privatelink.servicebus.windows.net'
]

resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-01-01' = {
name: virtualNetworkName
location: location
properties: {
addressSpace: {
addressPrefixes: [
addressPrefix
]
}
subnets: [
{
name: 'defaultSubnet'
properties: {
addressPrefix: '10.0.0.0/24'
}
}
]
}
}

resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = {
name: managedIdentityName
location: location
}

@batchSize(1)
resource privateDNSZones 'Microsoft.Network/privateDnsZones@2020-06-01' = [for privateDNSZone in privateDNSZoneNames: {
name: privateDNSZone
location: 'global'
}]

@description('The resource ID of the created Virtual Network Subnet.')
output subnetResourceId string = virtualNetwork.properties.subnets[0].id

@description('The principal ID of the created Managed Identity.')
output managedIdentityPrincipalId string = managedIdentity.properties.principalId

@description('The resource ID of the created Managed Identity.')
output managedIdentityResourceId string = managedIdentity.id

@description('The resource ID of the created Private DNS Zone for Purview Account.')
output purviewAccountPrivateDNSResourceId string = privateDNSZones[0].id

@description('The resource ID of the created Private DNS Zone for Purview Portal.')
output purviewPortalPrivateDNSResourceId string = privateDNSZones[1].id

@description('The resource ID of the created Private DNS Zone for Storage Account Blob.')
output storageBlobPrivateDNSResourceId string = privateDNSZones[2].id

@description('The resource ID of the created Private DNS Zone for Storage Account Queue.')
output storageQueuePrivateDNSResourceId string = privateDNSZones[3].id

@description('The resource ID of the created Private DNS Zone for Event Hub Namespace.')
output eventHubPrivateDNSResourceId string = privateDNSZones[4].id
Loading