-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdeploy-lab.ps1
More file actions
44 lines (36 loc) · 1.74 KB
/
deploy-lab.ps1
File metadata and controls
44 lines (36 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<#
.SYNOPSIS
Deploys the lab resources scoped to a subscription or resource group.
.DESCRIPTION
Provides a controlled deployment flow for lab environments, optionally limited to a resource group and specific Entra user IDs.
.PARAMETER DeploymentType
Defines the deployment scope; allowed values are subscription or resourcegroup.
.PARAMETER SubscriptionId
Specifies the Azure subscription that contains the lab resources.
.PARAMETER ResourceGroupName
In case of resourcegroup deployment, specifies the target resource group name.
.PARAMETER PreferredLocation
Specifies the preferred Azure region for resource deployment. "" indicates no preference.
.PARAMETER AllowedEntraUserIds
Optional list of Entra user object IDs permitted to access the lab resources.
#>
param(
[Parameter(Mandatory=$true)]
[ValidateSet('subscription','resourcegroup', 'resourcegroup-with-subscriptionowner')]
[string]$DeploymentType,
[Parameter(Mandatory=$true)]
[string]$SubscriptionId,
[string]$ResourceGroupName = "",
[string]$PreferredLocation = "",
[string[]]$AllowedEntraUserIds = @()
)
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
# Validate parameters
if($DeploymentType -eq 'resourcegroup' -and [string]::IsNullOrEmpty($ResourceGroupName)) {
throw "ResourceGroupName must be provided when DeploymentType is 'resourcegroup'."
}
# You can use the following lines to point to a template, sitting in the same folder
# $template = Join-Path $scriptPath "template.bicep"
# $template = Join-Path $scriptPath "template.json"
# You can send back information to the hackbox console (credentials) - Simply return a hashtable like this:
# @{"HackboxCredential" = @{ name = "AdminPassword" ; value = "TopSecret"; note = "Useful info here" }}