Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avm deployment script module and private network access #61

Open
wants to merge 77 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
e60fbb4
Add version.json files for storage account,
sebassem Dec 6, 2023
5cc44f9
Fix bug in login functionality
sebassem Dec 6, 2023
59218c5
Delete vending-test.bicep file
sebassem Dec 6, 2023
8abc70c
Remove deprecated module and update navigation
sebassem Dec 6, 2023
751eb9c
Fix formatting in README files
sebassem Dec 6, 2023
6922c91
Fix typo in README.md
sebassem Dec 6, 2023
b8c0f64
Remove unnecessary dependencies and update
sebassem Dec 6, 2023
9ef1d58
Add version.json and update module path in
sebassem Dec 6, 2023
69bc1c2
Update deployment script module version
sebassem Dec 6, 2023
14d1532
Delete version.json and main.bicep files for
sebassem Dec 6, 2023
d0ef787
Add Storage Account Management Policy module
sebassem Dec 6, 2023
004ac3c
Add Storage Account Local User module
sebassem Dec 6, 2023
3a4689a
Refactor storage account deployment in
sebassem Dec 6, 2023
980b82d
readme updates
sebassem Dec 6, 2023
927fb37
Delete unnecessary files
sebassem Dec 7, 2023
16a931f
Fix capitalization of headings in README files
sebassem Dec 7, 2023
b3f5c37
Fix resource types link and update
sebassem Dec 7, 2023
ff01304
Remove unnecessary note in README.md
sebassem Dec 7, 2023
d7a098f
Add storage account table, management policy,
sebassem Dec 7, 2023
0d62134
Update module paths in deploy.bicep files
sebassem Dec 7, 2023
7f09797
Delete unnecessary test files
sebassem Dec 7, 2023
e415f70
Remove empty line in output section
sebassem Dec 7, 2023
eb68d33
Update resource provider registration in
sebassem Dec 7, 2023
6f55b8d
Update roleDefinitionIdOrName in deploy.bicep
sebassem Dec 7, 2023
90d4222
Update built-in role assignments in deploy.bicep file
sebassem Dec 17, 2023
f5fd717
Fix deployment script resources sub-guid length
sebassem Dec 18, 2023
cac877e
Add 'Network Contributor' role definition
sebassem Dec 18, 2023
81b118d
Add 'Network Contributor' role assignment for resource group and subs…
sebassem Dec 18, 2023
dd86d86
Update deployment script storage account name
sebassem Dec 18, 2023
7201c5e
Update deployment script storage account name
sebassem Dec 18, 2023
56dd5d3
Update substring length in rsgDeploymentScriptName
sebassem Dec 18, 2023
6fd2208
Increase sleep time for eventual consistency in role assignments
sebassem Dec 18, 2023
decfadb
Update default value for deployment script storage account name
sebassem Dec 18, 2023
1ee3e53
Update resourceProviders in subResourceWrapper readme.md
sebassem Dec 18, 2023
363568c
Update sleep duration in Bicep Landing Zone tests
sebassem Dec 24, 2023
67dbf82
Refactor roleAssignment resource in deploy.bicep files
sebassem Dec 24, 2023
47d3606
Refactor role assignment queries in Bicep Landing Zone tests
sebassem Dec 24, 2023
a74501e
Reduce sleep time in role assignment checks
sebassem Dec 25, 2023
b902c56
Fix role assignment scope in Bicep Landing Zone tests
sebassem Dec 25, 2023
6cd741c
Refactor role assignment queries in full.tests.ps1
sebassem Dec 25, 2023
b551ca5
Add logging statements to check role assignment in Bicep Landing Zone…
sebassem Dec 25, 2023
6509e7f
Fix role assignment retrieval in Bicep Landing Zone (Sub) Vending Tests
sebassem Dec 25, 2023
a6422d9
Fix role assignment retrieval in Bicep Landing Zone tests
sebassem Dec 25, 2023
92552a2
Update azure/powershell version to v1.4.0
sebassem Dec 25, 2023
af9209f
Update azure/powershell version in module-tests.yml
sebassem Dec 25, 2023
3340c46
Add Azure account connection in RBAC assignment tests
sebassem Dec 25, 2023
b0ff832
Remove unnecessary code for RBAC assignment
sebassem Dec 25, 2023
4a8ca29
Increase sleep time for eventual consistency
sebassem Jan 11, 2024
82ba0c5
Add Azure login step to workflow
sebassem Jan 11, 2024
7f15dcd
Refactor Azure Login step in module-tests.yml
sebassem Jan 11, 2024
a252c3e
Update Azure Login step to refresh token
sebassem Jan 11, 2024
252549d
Remove commented out code for role assignment
sebassem Jan 11, 2024
8b3fca6
Reduce sleep time in Bicep Landing Zone tests
sebassem Jan 11, 2024
0d780a7
Increase sleep time for role assignment consistency
sebassem Jan 11, 2024
b6e8d73
Delete version.json and deploy.parameters.json files
sebassem Jan 16, 2024
be1e8d5
Remove commented out code and update resourceProviders in deploy.bicep
sebassem Jan 16, 2024
727417d
Fix error handling in Get-AzRoleAssignment
sebassem Jan 16, 2024
eb0a20f
Remove version.json and update managed identity module
sebassem Jan 16, 2024
53528bb
use virtual-network avm module
sebassem Jan 17, 2024
aee3f61
remove dc carml module
sebassem Jan 17, 2024
7c32401
Delete version.json files for storage account modules
sebassem Jan 18, 2024
70904fb
Remove private-endpoint version.json and private-dns-zone-group files
sebassem Jan 22, 2024
880ae88
Update RBAC role assignments
sebassem Jan 22, 2024
175d0bb
Update builtInRoleNames variable in deploy.bicep files
sebassem Jan 30, 2024
8c25c87
Update deploy.bicep to set userAssignedResourcesIds to null
sebassem Feb 11, 2024
8ac06bf
Add deploymentScriptLocation parameter to main.bicep
sebassem Feb 11, 2024
5d122a8
Add deploymentScriptLocation parameter
sebassem Feb 12, 2024
950cf6e
Remove resourceProviders from lz-vending and vwanSpoke modules
sebassem Feb 27, 2024
103d2ca
Refactor deployment script variables and add resourceProviders to hub…
sebassem Mar 17, 2024
dd677c4
Update deployment script resource names with unique identifiers
sebassem Mar 17, 2024
3e6b279
Update deployment script resource group name
sebassem Mar 17, 2024
b776c8c
Add resource providers for Microsoft.HybridCompute and Microsoft.AVS
sebassem Mar 17, 2024
3c65cc3
Update deployment script resource group and name with sub-guid
sebassem Mar 17, 2024
3262244
Remove resource providers from test files
sebassem Mar 17, 2024
0c25c3f
Remove empty line in deploy.bicep
sebassem Mar 25, 2024
a45f223
AAD Renames (#62) (#66)
sebassem Mar 25, 2024
78c3000
Refactor deploy.bicep file by removing unnecessary code
sebassem Mar 25, 2024
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
10 changes: 5 additions & 5 deletions .github/scripts/Wipe-AlzTenant.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[CmdletBinding()]
param (
#Added this back into parameters as error occurs if multiple tenants are found when using Get-AzTenant
[Parameter(Mandatory = $true, Position = 1, HelpMessage = "Please the Insert Tenant ID (GUID) of your Azure AD tenant e.g.'f73a2b89-6c0e-4382-899f-ea227cd6b68f'")]
[Parameter(Mandatory = $true, Position = 1, HelpMessage = "Please the Insert Tenant ID (GUID) of your Microsoft Entra tenant e.g.'f73a2b89-6c0e-4382-899f-ea227cd6b68f'")]
[string]
$tenantRootGroupID = "<Insert the Tenant ID (GUID) of your Azure AD tenant>",
$tenantRootGroupID = "<Insert the Tenant ID (GUID) of your Microsoft Entra tenant>",

[Parameter(Mandatory = $true, Position = 2, HelpMessage = "Insert the name of your intermediate root Management Group e.g. 'Contoso'")]
[string]
Expand Down Expand Up @@ -52,12 +52,12 @@ $subDeployments | ForEach-Object -Parallel {
}


# Get all AAD Tenant level deployments
# Get all Microsoft Entra Tenant level deployments
$tenantDeployments = Get-AzTenantDeployment

Write-Information "Removing all Tenant level deployments"

# For each AAD Tenant level deployment, remove it
# For each Microsoft Entra Tenant level deployment, remove it
$tenantDeployments | ForEach-Object -Parallel {
Write-Information "Removing $($_.DeploymentName) ..."
Remove-AzTenantDeployment -Id $_.Id
Expand Down Expand Up @@ -99,4 +99,4 @@ $StopWatch.Stop()

# Display timer output as table
Write-Information "Time taken to complete task:"
$StopWatch.Elapsed | Format-Table
$StopWatch.Elapsed | Format-Table
11 changes: 10 additions & 1 deletion .github/workflows/module-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ jobs:
"SUBID=$outputValue" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
azPSVersion: "10.4.1"

- name: Azure Login refresh
id: loginRefresh
uses: azure/login@v1
with:
client-id: ${{ secrets.ARM_CLIENT_ID }}
tenant-id: ${{ secrets.ARM_TENANT_ID }}
enable-AzPSSession: true
allow-no-subscriptions: true

- name: Pester Tests
id: pester
uses: azure/powershell@v1
Expand Down Expand Up @@ -116,7 +125,7 @@ jobs:
$rsgHsName = "rsg-${{ env.ARM_LOCATION }}-net-hs-pr-${{ env.GH_PR_NUMBER }}"
$rsgVwanName = "rsg-${{ env.ARM_LOCATION }}-net-vwan-pr-${{ env.GH_PR_NUMBER }}"
$rsgNetworkWatcherName = "NetworkWatcherRG"
$guid = $subId.substring(0,8)
$guid = $subId.substring(0,6)
$rsgDeploymentScriptName = "rsg-${{ env.ARM_LOCATION }}-ds-pr-${{ env.GH_PR_NUMBER }}-$guid"
$allRoleAssignmentsSub = Get-AzRoleAssignment -Scope "/subscriptions/$subId" -ErrorAction SilentlyContinue
$rbacIdentitiyNotFoundToCleanupContributor = $allRoleAssignmentsSub | Where-Object { $_.ObjectType -eq "Unknown" -and $_.RoleDefinitionName -eq "Contributor" }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
>
> ℹ️ This module is also available on the Bicep Module Registry [here](https://github.com/Azure/bicep-registry-modules/tree/main/modules/lz/sub-vending). Examples also included in our [wiki examples](https://github.com/Azure/bicep-lz-vending/wiki/examples). ℹ️

The landing zone Bicep modules are designed to accelerate deployment of the individual landing zones (aka Subscriptions) within an Azure AD Tenant.
The landing zone Bicep modules are designed to accelerate deployment of the individual landing zones (aka Subscriptions) within an Microsoft Entra Tenant.

> See the different types of landing zones in the Azure Landing Zones documentation here: [What is an Azure landing zone? - Platform vs. application landing zones](https://learn.microsoft.com/azure/cloud-adoption-framework/ready/landing-zone/#platform-vs-application-landing-zones)

Expand Down
31 changes: 29 additions & 2 deletions docs/wiki/ConsumerGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,38 @@

## Background

This repository has been created to help customers and partners to create, deploy and deliver landing zone Subscriptions into an Azure AD Tenant utilizing [Bicep](https://aka.ms/bicep) as the Infrastructure-as-Code (IaC) tooling and language of choice.
This repository has been created to help customers and partners to create, deploy and deliver landing zone Subscriptions into an Microsoft Entra Tenant utilizing [Bicep](https://aka.ms/bicep) as the Infrastructure-as-Code (IaC) tooling and language of choice.

## Ways to Consume `bicep-lz-vending`

There are various ways to consume the Bicep modules included in `bicep-lz-vending`. The options are:
### Recommended Way to Consume

The recommend way is to consume the module directly from the [Bicep public registry](https://github.com/Azure/bicep-registry-modules/tree/main/modules/lz/sub-vending#examples)

```bicep
targetScope = 'managementGroup'

module sub001 'br/public:lz/sub-vending:1.5.1' = {
name: 'sub001'
params: {
subscriptionAliasEnabled: true
subscriptionBillingScope: '/providers/Microsoft.Billing/billingAccounts/1234567/enrollmentAccounts/123456'
subscriptionAliasName: 'sub-test-001'
subscriptionDisplayName: 'sub-test-001'
subscriptionTags: {
example: 'true'
}
subscriptionWorkload: 'Production'
subscriptionManagementGroupAssociationEnabled: true
subscriptionManagementGroupId: 'corp'
// Other parameter inputs available, see docs
}
}
```

### Other Ways to Consume

There are a number of other ways to consume the Bicep modules included in `bicep-lz-vending`. The options are:

- Creating your own GitHub Repository & Utilizing the `Invoke-GitHubReleaseFetcher.ps1` script & `gh-release-checker.yml` GitHub Action Workflow
- See detailed instruction on using this [below](#creating-your-own-github-repository--utilizing-the-invoke-githubreleasefetcherps1-script--gh-release-checkeryml-github-action-workflow)
Expand Down
33 changes: 29 additions & 4 deletions main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ targetScope = 'managementGroup'

metadata name = '`main.bicep` Parameters'

metadata description = 'This module is designed to accelerate deployment of landing zones (aka Subscriptions) within an Azure AD Tenant.'
metadata description = 'This module is designed to accelerate deployment of landing zones (aka Subscriptions) within an Microsoft Entra Tenant.'

metadata details = '''These are the input parameters for the Bicep module: [`main.bicep`](./main.bicep)

Expand Down Expand Up @@ -429,7 +429,12 @@ param roleAssignmentEnabled bool = false

Each object must contain the following `keys`:
- `principalId` = The Object ID of the User, Group, SPN, Managed Identity to assign the RBAC role too.
- `definition` = The Name of built-In RBAC Roles or a Resource ID of a Built-in or custom RBAC Role Definition.
- `definition` = The Name of one of the pre-defined built-In RBAC Roles or a Resource ID of a Built-in or custom RBAC Role Definition as follows:
- You can only provide the RBAC role name of the pre-defined roles (Contributor, Owner, Reader, Network Contributor, Role Based Access Control Administrator (Preview), User Access Administrator, Security Admin). We only provide those roles as they are the most common ones to assign to a new subscription, also to reduce the template size and complexity in case we define each and every Built-in RBAC role.
- You can provide the Resource ID of a Built-in or custom RBAC Role Definition
- e.g. `/providers/Microsoft.Authorization/roleDefinitions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`
- You can provide the RBAC role Id of a Built-in RBAC Role Definition
- e.g. `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`
- `relativeScope` = 2 options can be provided for input value:
1. `''` *(empty string)* = Make RBAC Role Assignment to Subscription scope
2. `'/resourceGroups/<RESOURCE GROUP NAME>'` = Make RBAC Role Assignment to specified Resource Group
Expand All @@ -451,7 +456,7 @@ For more information on the telemetry collected by this module, that is controll
param disableTelemetry bool = false

@sys.description('Guid for the deployment script resources names based on subscription Id.')
var deploymentScriptResourcesSubGuid = substring((subscriptionAliasEnabled && empty(existingSubscriptionId)) ? createSubscription.outputs.subscriptionId : existingSubscriptionId,0,8)
var deploymentScriptResourcesSubGuid = substring((subscriptionAliasEnabled && empty(existingSubscriptionId)) ? createSubscription.outputs.subscriptionId : existingSubscriptionId,0,6)

@sys.description('The name of the resource group to create the deployment script for resource providers registration.')
param deploymentScriptResourceGroupName string = 'rsg-${deployment().location}-ds'
Expand All @@ -462,6 +467,21 @@ param deploymentScriptName string = 'ds-${deployment().location}'
@sys.description('The name of the user managed identity for the resource providers registration deployment script.')
param deploymentScriptManagedIdentityName string = 'id-${deployment().location}'

@maxLength(64)
@sys.description('The name of the private virtual network for the deployment script. The string must consist of a-z, A-Z, 0-9, -, _, and . (period) and be between 2 and 64 characters in length.')
param deploymentScriptVirtualNetworkName string = 'vnet-${deployment().location}'

@sys.description('The name of the network security group for the deployment script private subnet.')
param deploymentScriptNetworkSecurityGroupName string = 'nsg-${deployment().location}'

@sys.description('The address prefix of the private virtual network for the deployment script.')
param virtualNetworkDeploymentScriptAddressPrefix string = '192.168.0.0/24'

@sys.description('The name of the storage account for the deployment script.')
param deploymentScriptStorageAccountName string = 'stglzds${deployment().location}'

@sys.description('The location of the deployment script. Use region shortnames e.g. uksouth, eastus, etc.')
param deploymentScriptLocation string = deployment().location

@metadata({
example: {
Expand All @@ -471,7 +491,7 @@ param deploymentScriptManagedIdentityName string = 'id-${deployment().location}'

})
@sys.description('''
An object of resource providers and resource providers features to register. If left blank/empty, a list of most common resource providers will be registered.
An object of resource providers and resource providers features to register. If left blank/empty, no resource providers will be registered.

- Type: `{}` Object
- Default value: `{
Expand Down Expand Up @@ -682,6 +702,11 @@ module createSubscriptionResources 'src/self/subResourceWrapper/deploy.bicep' =
deploymentScriptName: '${deploymentScriptName}-${deploymentScriptResourcesSubGuid}'
deploymentScriptManagedIdentityName: '${deploymentScriptManagedIdentityName}-${deploymentScriptResourcesSubGuid}'
resourceProviders: resourceProviders
deploymentScriptVirtualNetworkName: deploymentScriptVirtualNetworkName
deploymentScriptNetworkSecurityGroupName: deploymentScriptNetworkSecurityGroupName
deploymentScriptLocation: deploymentScriptLocation
virtualNetworkDeploymentScriptAddressPrefix: virtualNetworkDeploymentScriptAddressPrefix
deploymentScriptStorageAccountName: '${deploymentScriptStorageAccountName}${deploymentScriptResourcesSubGuid}'
}
}

Expand Down
Loading
Loading