Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
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
3 changes: 1 addition & 2 deletions .github/workflows/ms.recoveryservices.vaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ jobs:
- name: 'Using test file [${{ matrix.moduleTestFilePaths }}]'
uses: ./.github/actions/templates/validateModuleDeployment
with:
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
parameterFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}'
templateFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}'
location: '${{ env.location }}'
resourceGroupName: '${{ env.resourceGroupName }}'
subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
@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

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

resource privateDNSZone 'Microsoft.Network/privateDnsZones@2020-06-01' = {
name: 'privatelink.siterecovery.windowsazure.com'
location: 'global'

resource virtualNetworkLinks 'virtualNetworkLinks@2020-06-01' = {
name: '${virtualNetwork.name}-vnetlink'
location: 'global'
properties: {
virtualNetwork: {
id: virtualNetwork.id
}
registrationEnabled: false
}
}
}

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

@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.')
output privateDNSResourceId string = privateDNSZone.id
Original file line number Diff line number Diff line change
@@ -0,0 +1,327 @@
targetScope = 'subscription'

// ========== //
// Parameters //
// ========== //
@description('Optional. The name of the resource group to deploy for testing purposes.')
@maxLength(90)
param resourceGroupName string = 'ms.recoveryservices.vaults-${serviceShort}-rg'

@description('Optional. The location to deploy resources to.')
param location string = deployment().location

@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.')
param serviceShort string = 'rsvcom'

// =========== //
// Deployments //
// =========== //

// General resources
// =================
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: resourceGroupName
location: location
}

module resourceGroupResources 'dependencies.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-paramNested'
params: {
virtualNetworkName: 'dep-<<namePrefix>>-vnet-${serviceShort}'
managedIdentityName: 'dep-<<namePrefix>>-msi-${serviceShort}'
}
}

// Diagnostics
// ===========
module diagnosticDependencies '../../../../.shared/dependencyConstructs/diagnostic.dependencies.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-diagnosticDependencies'
params: {
storageAccountName: 'dep<<namePrefix>>diasa${serviceShort}01'
logAnalyticsWorkspaceName: 'dep-<<namePrefix>>-law-${serviceShort}'
eventHubNamespaceEventHubName: 'dep-<<namePrefix>>-evh-${serviceShort}'
eventHubNamespaceName: 'dep-<<namePrefix>>-evhns-${serviceShort}'
location: location
}
}

// ============== //
// Test Execution //
// ============== //

module testDeployment '../../deploy.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name)}-test-${serviceShort}'
params: {
name: '<<namePrefix>>${serviceShort}001'
backupConfig: {
enhancedSecurityState: 'Disabled'
softDeleteFeatureState: 'Disabled'
}
backupPolicies: [
{
name: 'VMpolicy'
properties: {
backupManagementType: 'AzureIaasVM'
instantRPDetails: {}
instantRpRetentionRangeInDays: 2
protectedItemsCount: 0
retentionPolicy: {
dailySchedule: {
retentionDuration: {
count: 180
durationType: 'Days'
}
retentionTimes: [
'2019-11-07T07:00:00Z'
]
}
monthlySchedule: {
retentionDuration: {
count: 60
durationType: 'Months'
}
retentionScheduleFormatType: 'Weekly'
retentionScheduleWeekly: {
daysOfTheWeek: [
'Sunday'
]
weeksOfTheMonth: [
'First'
]
}
retentionTimes: [
'2019-11-07T07:00:00Z'
]
}
retentionPolicyType: 'LongTermRetentionPolicy'
weeklySchedule: {
daysOfTheWeek: [
'Sunday'
]
retentionDuration: {
count: 12
durationType: 'Weeks'
}
retentionTimes: [
'2019-11-07T07:00:00Z'
]
}
yearlySchedule: {
monthsOfYear: [
'January'
]
retentionDuration: {
count: 10
durationType: 'Years'
}
retentionScheduleFormatType: 'Weekly'
retentionScheduleWeekly: {
daysOfTheWeek: [
'Sunday'
]
weeksOfTheMonth: [
'First'
]
}
retentionTimes: [
'2019-11-07T07:00:00Z'
]
}
}
schedulePolicy: {
schedulePolicyType: 'SimpleSchedulePolicy'
scheduleRunFrequency: 'Daily'
scheduleRunTimes: [
'2019-11-07T07:00:00Z'
]
scheduleWeeklyFrequency: 0
}
timeZone: 'UTC'
}
}
{
name: 'sqlpolicy'
properties: {
backupManagementType: 'AzureWorkload'
protectedItemsCount: 0
settings: {
isCompression: true
issqlcompression: true
timeZone: 'UTC'
}
subProtectionPolicy: [
{
policyType: 'Full'
retentionPolicy: {
monthlySchedule: {
retentionDuration: {
count: 60
durationType: 'Months'
}
retentionScheduleFormatType: 'Weekly'
retentionScheduleWeekly: {
daysOfTheWeek: [
'Sunday'
]
weeksOfTheMonth: [
'First'
]
}
retentionTimes: [
'2019-11-07T22:00:00Z'
]
}
retentionPolicyType: 'LongTermRetentionPolicy'
weeklySchedule: {
daysOfTheWeek: [
'Sunday'
]
retentionDuration: {
count: 104
durationType: 'Weeks'
}
retentionTimes: [
'2019-11-07T22:00:00Z'
]
}
yearlySchedule: {
monthsOfYear: [
'January'
]
retentionDuration: {
count: 10
durationType: 'Years'
}
retentionScheduleFormatType: 'Weekly'
retentionScheduleWeekly: {
daysOfTheWeek: [
'Sunday'
]
weeksOfTheMonth: [
'First'
]
}
retentionTimes: [
'2019-11-07T22:00:00Z'
]
}
}
schedulePolicy: {
schedulePolicyType: 'SimpleSchedulePolicy'
scheduleRunDays: [
'Sunday'
]
scheduleRunFrequency: 'Weekly'
scheduleRunTimes: [
'2019-11-07T22:00:00Z'
]
scheduleWeeklyFrequency: 0
}
}
{
policyType: 'Differential'
retentionPolicy: {
retentionDuration: {
count: 30
durationType: 'Days'
}
retentionPolicyType: 'SimpleRetentionPolicy'
}
schedulePolicy: {
schedulePolicyType: 'SimpleSchedulePolicy'
scheduleRunDays: [
'Monday'
]
scheduleRunFrequency: 'Weekly'
scheduleRunTimes: [
'2017-03-07T02:00:00Z'
]
scheduleWeeklyFrequency: 0
}
}
{
policyType: 'Log'
retentionPolicy: {
retentionDuration: {
count: 15
durationType: 'Days'
}
retentionPolicyType: 'SimpleRetentionPolicy'
}
schedulePolicy: {
scheduleFrequencyInMins: 120
schedulePolicyType: 'LogSchedulePolicy'
}
}
]
workLoadType: 'SQLDataBase'
}
}
{
name: 'filesharepolicy'
properties: {
backupManagementType: 'AzureStorage'
protectedItemsCount: 0
retentionPolicy: {
dailySchedule: {
retentionDuration: {
count: 30
durationType: 'Days'
}
retentionTimes: [
'2019-11-07T04:30:00Z'
]
}
retentionPolicyType: 'LongTermRetentionPolicy'
}
schedulePolicy: {
schedulePolicyType: 'SimpleSchedulePolicy'
scheduleRunFrequency: 'Daily'
scheduleRunTimes: [
'2019-11-07T04:30:00Z'
]
scheduleWeeklyFrequency: 0
}
timeZone: 'UTC'
workloadType: 'AzureFileShare'
}
}
]
backupStorageConfig: {
crossRegionRestoreFlag: true
storageModelType: 'GeoRedundant'
}
diagnosticLogsRetentionInDays: 7
diagnosticStorageAccountId: diagnosticDependencies.outputs.storageAccountResourceId
diagnosticWorkspaceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId
diagnosticEventHubAuthorizationRuleId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId
diagnosticEventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName
lock: 'CanNotDelete'
privateEndpoints: [
{
privateDnsZoneGroup: {
privateDNSResourceIds: [
resourceGroupResources.outputs.privateDNSResourceId
]
}
service: 'AzureSiteRecovery'
subnetResourceId: resourceGroupResources.outputs.subnetResourceId
}
]
roleAssignments: [
{
principalIds: [
resourceGroupResources.outputs.managedIdentityPrincipalId
]
roleDefinitionIdOrName: 'Reader'
}
]
systemAssignedIdentity: true
userAssignedIdentities: {
'${resourceGroupResources.outputs.managedIdentityResourceId}': {}
}
}
}
Loading