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

Response to FRs - Issues #267 and #290 - POC in RG Name and Deployment Snippets #312

Merged
merged 31 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a41d24b
1
4pplied Aug 23, 2022
24bb1ea
remove deployment type from naming convention
4pplied Aug 25, 2022
f79f1ef
example module 2
Aug 26, 2022
8aa0665
carml naming
Aug 30, 2022
f2b9c9f
carml naming
Aug 30, 2022
d2830c1
Merge branch 'Azure:main' into snippetsandpocname
4pplied Sep 1, 2022
026d5c1
carml naming
Sep 1, 2022
e55c4a7
carml names
Sep 1, 2022
57d0c0c
Merge branch 'main' into snippetsandpocname
jtracey93 Sep 5, 2022
7547419
CARML and orchestration
Sep 12, 2022
aa7f674
Merge branch 'snippetsandpocname' of https://github.com/JamJarchitect…
Sep 12, 2022
e2eb9e2
Merge branch 'Azure:main' into snippetsandpocname
4pplied Sep 12, 2022
29b218e
formatting
Sep 12, 2022
9810c13
Merge branch 'snippetsandpocname' of https://github.com/JamJarchitect…
Sep 12, 2022
f480aab
prefix, pdnszone, conforming names
Sep 12, 2022
00e8b3b
Merge branch 'main' into snippetsandpocname
4pplied Oct 3, 2022
537de52
formatting bash - one module test
Oct 5, 2022
c5e79b7
remove warning from test module
Oct 5, 2022
6d69919
bash changes
Oct 5, 2022
fc7f31a
whitespaces
Oct 6, 2022
ea1c4b4
bash snippet changes
Oct 10, 2022
d3e1943
Merge branch 'main' into snippetsandpocname
Oct 10, 2022
bfe1d5f
editorconfig
Oct 10, 2022
16e881d
Merge branch 'main' into snippetsandpocname
jtracey93 Oct 10, 2022
02715de
prep for v0.10.5 release (#2)
4pplied Oct 11, 2022
80a6897
Merge branch 'Azure:main' into snippetsandpocname
4pplied Oct 11, 2022
f66efa6
Merge branch 'main' into snippetsandpocname
4pplied Oct 14, 2022
33ead1b
Merge branch 'main' into snippetsandpocname
Nov 1, 2022
416f1d1
amendments
Nov 2, 2022
9eda44b
Merge branch 'main' into snippetsandpocname
4pplied Nov 2, 2022
8a4e251
amendments
Nov 2, 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: 35 additions & 20 deletions infra-as-code/bicep/CRML/containerRegistry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ Module deploys the following resources:

The module requires the following inputs:

Parameter | Type | Default | Description | Requirement | Example
----------- | ---- | ------- |----------- | ----------- | -------
parAcrName | string | acr${uniqueString(resourceGroup().id)} | Name of Azure Container Registry to deploy | 5-50 char | acr5cix6w3rcizn
parACRSku | string | Basic | SKU of Azure Container Registry to deploy to Azure | Basic or Standard or Premium | Basic
parLocation | string | resourceGroup().location | Location where Public Azure Container Registry will be deployed | Valid Azure Region | eastus2
parTags | object | none | Tags to be appended to resource | none | {"Environment" : "Development"}
| Parameter | Type | Default | Description | Requirement | Example |
| ----------- | ------ | -------------------------------------- | --------------------------------------------------------------- | ---------------------------- | ------------------------------- |
| parAcrName | string | acr${uniqueString(resourceGroup().id)} | Name of Azure Container Registry to deploy | 5-50 char | acr5cix6w3rcizn |
| parACRSku | string | Basic | SKU of Azure Container Registry to deploy to Azure | Basic or Standard or Premium | Basic |
| parLocation | string | resourceGroup().location | Location where Public Azure Container Registry will be deployed | Valid Azure Region | eastus2 |
| parTags | object | none | Tags to be appended to resource | none | {"Environment" : "Development"} |

## Outputs

The module will generate the following outputs:

Output | Type | Example
------ | ---- | --------
outLoginServer | string | acr5cix6w3rcizna.azurecr.io
| Output | Type | Example |
| -------------- | ------ | --------------------------- |
| outLoginServer | string | acr5cix6w3rcizna.azurecr.io |

## Deployment

Expand All @@ -36,26 +36,41 @@ We will take the default values and not pass any parameters.
### Azure CLI

```bash
az group create --location eastus2 \
dateYMD=$(date +%Y%m%dT%H%M%S%NZ)
NAME="alz-ContainerRegistry-${dateYMD}"
RESOURCEGROUP="Bicep_ACR"
4pplied marked this conversation as resolved.
Show resolved Hide resolved
PARAMETERS="@infra-as-code/bicep/CRML/containerRegistry/parameters/containerRegistry.parameters.all.json"
TEMPLATEFILE="infra-as-code/bicep/CRML/containerRegistry/containerRegistry.bicep"

az group create --location eastus \
--name Bicep_ACR
4pplied marked this conversation as resolved.
Show resolved Hide resolved

az deployment group create \
--resource-group Bicep_Acr \
--template-file infra-as-code/bicep/CRML/containerRegistry/containerRegistry.bicep \
--parameters @infra-as-code/bicep/CRML/containerRegistry/parameters/containerRegistry.parameters.all.json
$inputObject = @(
'--name', ('alz-ContainerRegistry-{0}' -f (-join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63])),
'--resource-group', 'Bicep_ACR',
'--parameters', '@infra-as-code/bicep/CRML/containerRegistry/parameters/containerRegistry.parameters.all.json',
'--template-file', "infra-as-code/bicep/CRML/containerRegistry/containerRegistry.bicep",
)
4pplied marked this conversation as resolved.
Show resolved Hide resolved

az deployment group create --name ${NAME:0:63} --resource-group $RESOURCEGROUP --parameters $PARAMETERS --template-file $TEMPLATEFILE
```

### PowerShell

```powershell
New-AzResourceGroup -Name 'Bicep_ACR' `
4pplied marked this conversation as resolved.
Show resolved Hide resolved
-Location 'EastUs2'

New-AzResourceGroupDeployment `
-TemplateFile infra-as-code/bicep/CRML/containerRegistry/containerRegistry.bicep `
-TemplateParameterFile infra-as-code/bicep/CRML/containerRegistry/parameters/containerRegistry.parameters.all.json
-Location 'EastUs'

$inputObject = @{
DeploymentName = 'alz-ContainerRegistry-{0}' -f (-join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63])
ResourceGroupName = 'Bicep_ACR'
4pplied marked this conversation as resolved.
Show resolved Hide resolved
TemplateParameterFile = 'infra-as-code/bicep/CRML/containerRegistry/parameters/containerRegistry.parameters.all.json'
TemplateFile = "infra-as-code/bicep/CRML/containerRegistry/containerRegistry.bicep"
}

New-AzResourceGroupDeployment @inputObject
```

## Bicep Visualizer

![Bicep Visualizer](media/bicepVisualizer.png "Bicep Visualizer")
![Bicep Visualizer](media/bicepVisualizer.png "Bicep Visualizer")
27 changes: 19 additions & 8 deletions infra-as-code/bicep/CRML/subscriptionAlias/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,31 @@ In this example, the Subscription is created upon an EA Account through a tenant
> For the below examples we assume you have downloaded or cloned the Git repo as-is and are in the root of the repository as your selected directory in your terminal of choice.

### Azure CLI
**NOTE: As there is some PowerShell code within the CLI, there is a requirement to execute the deployments in a cross-platform terminal which has PowerShell installed.**
4pplied marked this conversation as resolved.
Show resolved Hide resolved
```bash
az deployment tenant create \
--template-file infra-as-code/bicep/CRML/subscriptionAlias/subscriptionAlias.bicep \
--parameters @infra-as-code/bicep/CRML/subscriptionAlias/parameters/subscriptionAlias.parameters.all.json \
--location eastus

$inputObject = @(
'--name', ('alz-SubscriptionAlias-{0}' -f (-join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63])),
'--parameters', '@infra-as-code/bicep/CRML/subscriptionAlias/parameters/subscriptionAlias.parameters.all.json',
'--location', 'EastUS',
'--template-file', "infra-as-code/bicep/CRML/subscriptionAlias/subscriptionAlias.bicep"
)

4pplied marked this conversation as resolved.
Show resolved Hide resolved
az deployment tenant create @inputObject
4pplied marked this conversation as resolved.
Show resolved Hide resolved
```

### PowerShell

```powershell
New-AzTenantDeployment `
-TemplateFile infra-as-code/bicep/CRML/subscriptionAlias/subscriptionAlias.bicep `
-TemplateParameterFile infra-as-code/bicep/CRML/subscriptionAlias/parameters/subscriptionAlias.parameters.all.json `
-Location eastus

$inputObject = @{
DeploymentName = 'alz-SubscriptionAlias-{0}' -f (-join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63])
TemplateParameterFile = 'infra-as-code/bicep/CRML/subscriptionAlias/parameters/subscriptionAlias.parameters.all.json'
Location = 'EastUS'
TemplateFile = "infra-as-code/bicep/CRML/subscriptionAlias/subscriptionAlias.bicep"
}

New-AzTenantDeployment @inputObject
```

### Output Screenshot
Expand Down
67 changes: 47 additions & 20 deletions infra-as-code/bicep/modules/customRoleDefinitions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,42 +47,69 @@ Input parameter file `parameters/customRoleDefinitions.parameters.all.json` defi
> For the examples below we assume you have downloaded or cloned the Git repo as-is and are in the root of the repository as your selected directory in your terminal of choice.

### Azure CLI

```bash
# For Azure global regions
az deployment mg create \
--template-file infra-as-code/bicep/modules/customRoleDefinitions/customRoleDefinitions.bicep \
--parameters @infra-as-code/bicep/modules/customRoleDefinitions/parameters/customRoleDefinitions.parameters.all.json \
--location eastus \
--management-group-id alz

# Management Group ID
MGID="alz"

# Chosen Azure Region
LOCATION="eastus"

dateYMD=$(date +%Y%m%dT%H%M%S%NZ)
NAME="alz-CustomRoleDefsDeployment-${dateYMD}"
PARAMETERS="@infra-as-code/bicep/modules/customRoleDefinitions/parameters/customRoleDefinitions.parameters.all.json"
TEMPLATEFILE="infra-as-code/bicep/modules/customRoleDefinitions/customRoleDefinitions.bicep"

az deployment mg create --name ${NAME:0:63} --parameters $PARAMETERS --location $LOCATION --management-group-id $MGID --template-file $TEMPLATEFILE
```
OR
```bash
# For Azure China regions
az deployment mg create \
--template-file infra-as-code/bicep/modules/customRoleDefinitions/mc-customRoleDefinitions.bicep \
--parameters @infra-as-code/bicep/modules/customRoleDefinitions/parameters/customRoleDefinitions.parameters.all.json \
--location chinaeast2 \
--management-group-id alz

# Management Group ID
MGID="alz"

# Chosen Azure Region
LOCATION="chinaeast2"

dateYMD=$(date +%Y%m%dT%H%M%S%NZ)
NAME="alz-CustomRoleDefsDeployment-${dateYMD}"
PARAMETERS="@infra-as-code/bicep/modules/customRoleDefinitions/parameters/customRoleDefinitions.parameters.all.json"
TEMPLATEFILE="infra-as-code/bicep/modules/customRoleDefinitions/mc-customRoleDefinitions.bicep"

az deployment mg create --name ${NAME:0:63} --parameters $PARAMETERS --location $LOCATION --management-group-id $MGID --template-file $TEMPLATEFILE
```

### PowerShell

```powershell
# For Azure global regions
New-AzManagementGroupDeployment `
-TemplateFile infra-as-code/bicep/modules/customRoleDefinitions/customRoleDefinitions.bicep `
-TemplateParameterFile infra-as-code/bicep/modules/customRoleDefinitions/parameters/customRoleDefinitions.parameters.all.json `
-Location eastus `
-ManagementGroupId alz

$inputObject = @{
DeploymentName = 'alz-CustomRoleDefsDeployment-{0}' -f (-join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63])
ManagementGroupId = 'alz'
Location = 'eastus'
TemplateParameterFile = 'infra-as-code/bicep/modules/customRoleDefinitions/parameters/customRoleDefinitions.parameters.all.json'
TemplateFile = "infra-as-code/bicep/modules/customRoleDefinitions/customRoleDefinitions.bicep"
}

New-AzManagementGroupDeployment @inputObject
```
OR
```powershell
# For Azure China regions
New-AzManagementGroupDeployment `
-TemplateFile infra-as-code/bicep/modules/customRoleDefinitions/mc-customRoleDefinitions.bicep `
-TemplateParameterFile infra-as-code/bicep/modules/customRoleDefinitions/parameters/customRoleDefinitions.parameters.all.json `
-Location chinaeast2 `
-ManagementGroupId alz

$inputObject = @{
DeploymentName = 'alz-CustomRoleDefsDeployment-{0}' -f (-join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63])
ManagementGroupId = 'alz'
Location = 'chinaeast2'
TemplateParameterFile = 'infra-as-code/bicep/modules/customRoleDefinitions/parameters/customRoleDefinitions.parameters.all.json'
TemplateFile = "infra-as-code/bicep/modules/customRoleDefinitions/mc-customRoleDefinitions.bicep"
}

New-AzManagementGroupDeployment @inputObject
```

![Example Deployment Output](media/exampleDeploymentOutput.png "Example Deployment Output")
Expand Down
78 changes: 58 additions & 20 deletions infra-as-code/bicep/modules/hubNetworking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,32 +97,47 @@ There are two different sets of input parameters; one for deploying to Azure glo
### Azure CLI
```bash
# For Azure global regions

# Set Platform connectivity subscription ID as the the current subscription
ConnectivitySubscriptionId="[your platform connectivity subscription ID]"

az account set --subscription $ConnectivitySubscriptionId

# Set the top level MG Prefix in accordance to your environment. This example assumes default 'alz'.
TopLevelMGPrefix="alz"

dateYMD=$(date +%Y%m%dT%H%M%S%NZ)
NAME="alz-HubNetworkingDeploy-${dateYMD}"
GROUP="rg-$TopLevelMGPrefix-hub-networking-001"
PARAMETERS="@infra-as-code/bicep/modules/hubNetworking/parameters/hubNetworking.parameters.all.json"
TEMPLATEFILE="infra-as-code/bicep/modules/hubNetworking/hubNetworking.bicep"

az group create --location eastus \
--name Hub_Networking_POC
--name $ResourceGroupName
4pplied marked this conversation as resolved.
Show resolved Hide resolved

az deployment group create \
--resource-group HUB_Networking_POC \
--template-file infra-as-code/bicep/modules/hubNetworking/hubNetworking.bicep \
--parameters @infra-as-code/bicep/modules/hubNetworking/parameters/hubNetworking.parameters.all.json
az deployment group create --name ${NAME:0:63} --resource-group $GROUP --parameters $PARAMETERS --template-file $TEMPLATEFILE
```
OR
```bash
# For Azure China regions
# Set Platform connectivity subscription ID as the the current subscription
ConnectivitySubscriptionId="[your platform connectivity subscription ID]"

az account set --subscription $ConnectivitySubscriptionId

# Set the top level MG Prefix in accordance to your environment. This example assumes default 'alz'.
TopLevelMGPrefix="alz"

dateYMD=$(date +%Y%m%dT%H%M%S%NZ)
NAME="alz-HubNetworkingDeploy-${dateYMD}"
GROUP="rg-$TopLevelMGPrefix-hub-networking-001"
PARAMETERS="@infra-as-code/bicep/modules/hubNetworking/parameters/mc-hubNetworking.parameters.all.json"
TEMPLATEFILE="infra-as-code/bicep/modules/hubNetworking/hubNetworking.bicep"

az group create --location chinaeast2 \
--name Hub_Networking_POC
--name $ResourceGroupName
4pplied marked this conversation as resolved.
Show resolved Hide resolved

az deployment group create \
--resource-group HUB_Networking_POC \
--template-file infra-as-code/bicep/modules/hubNetworking/hubNetworking.bicep \
--parameters @infra-as-code/bicep/modules/hubNetworking/parameters/mc-hubNetworking.parameters.all.json
az deployment group create --name ${NAME:0:63} --resource-group $GROUP --parameters $PARAMETERS --template-file $TEMPLATEFILE
```

### PowerShell
Expand All @@ -134,13 +149,26 @@ $ConnectivitySubscriptionId = "[your platform connectivity subscription ID]"

Select-AzSubscription -SubscriptionId $ConnectivitySubscriptionId

New-AzResourceGroup -Name 'Hub_Networking_POC' `
# Set Platform management subscripion ID as the the current subscription
$ManagementSubscriptionId = "[your platform management subscription ID]"

# Set the top level MG Prefix in accordance to your environment. This example assumes default 'alz'.
$TopLevelMGPrefix = "alz"

$ResourceGroupName = "rg-$TopLevelMGPrefix-hub-networking-001"
4pplied marked this conversation as resolved.
Show resolved Hide resolved

# Parameters necessary for deployment
$inputObject = @{
DeploymentName = 'alz-HubNetworkingDeploy-{0}' -f (-join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63])
ResourceGroupName = $ResourceGroupName
TemplateParameterFile = "infra-as-code/bicep/modules/hubNetworking/parameters/hubNetworking.parameters.all.json"
TemplateFile = "infra-as-code/bicep/modules/hubNetworking/hubNetworking.bicep"
}

New-AzResourceGroup -Name $ResourceGroupName `
-Location 'eastus'

New-AzResourceGroupDeployment `
-TemplateFile infra-as-code/bicep/modules/hubNetworking/hubNetworking.bicep `
-TemplateParameterFile infra-as-code/bicep/modules/hubNetworking/parameters/hubNetworking.parameters.all.json `
-ResourceGroupName 'Hub_Networking_POC'
New-AzResourceGroupDeployment @inputObject
```
OR
```powershell
Expand All @@ -150,13 +178,23 @@ $ConnectivitySubscriptionId = "[your platform connectivity subscription ID]"

Select-AzSubscription -SubscriptionId $ConnectivitySubscriptionId

New-AzResourceGroup -Name 'Hub_Networking_POC' `
# Set the top level MG Prefix in accordance to your environment. This example assumes default 'alz'.
$TopLevelMGPrefix = "alz"

$ResourceGroupName = "rg-$TopLevelMGPrefix-hub-networking-001"
4pplied marked this conversation as resolved.
Show resolved Hide resolved

# Parameters necessary for deployment
$inputObject = @{
DeploymentName = 'alz-HubNetworkingDeploy-{0}' -f (-join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63])
ResourceGroupName = $ResourceGroupName
TemplateParameterFile = "infra-as-code/bicep/modules/hubNetworking/parameters/mc-hubNetworking.parameters.all.json"
TemplateFile = "infra-as-code/bicep/modules/hubNetworking/hubNetworking.bicep"
}

New-AzResourceGroup -Name $ResourceGroupName `
-Location 'chinaeast2'

New-AzResourceGroupDeployment `
-TemplateFile infra-as-code/bicep/modules/hubNetworking/hubNetworking.bicep `
-TemplateParameterFile infra-as-code/bicep/modules/hubNetworking/parameters/mc-hubNetworking.parameters.all.json `
-ResourceGroupName 'Hub_Networking_POC'
New-AzResourceGroupDeployment @inputObject
```
## Example Output in Azure global regions

Expand Down
Loading