59 lines
1.4 KiB
PowerShell
59 lines
1.4 KiB
PowerShell
[CmdletBinding()]
|
|
param (
|
|
[string]
|
|
$ComputerName,
|
|
|
|
[int]
|
|
$CPU = 1,
|
|
|
|
[int]
|
|
$MemoryGB = 4,
|
|
|
|
[int]
|
|
$DiskOsGB = 128,
|
|
|
|
[int]
|
|
$DiskDataGB = 0,
|
|
|
|
[string]
|
|
$Subnet,
|
|
|
|
[string]
|
|
$OS,
|
|
|
|
[string]
|
|
$Environment,
|
|
|
|
[string]
|
|
$Subscription,
|
|
|
|
[string]
|
|
$AppName,
|
|
|
|
[string]
|
|
$LicensingRestrictions
|
|
)
|
|
|
|
$params = @{
|
|
ComputerName = $ComputerName;
|
|
CPU = $CPU;
|
|
MemoryGB = $MemoryGB;
|
|
DiskOsGB = $DiskOsGB;
|
|
DiskDataGB = $DiskDataGB;
|
|
Subnet = $Subnet;
|
|
OS = $OS;
|
|
Environment = $Environment;
|
|
Subscription = $Subscription;
|
|
AppName = $AppName;
|
|
LicensingRestrictions = $LicensingRestrictions;
|
|
Credential = $Credential;
|
|
}
|
|
|
|
Write-Verbose -Message "Connect to Azure using Service Principal" -Verbose
|
|
$tenantId = '2dea0464-da51-4a88-bae2-b3db94bc0c54'
|
|
$AppId = '60244573-7130-4026-9c6d-47de73f8ca29'
|
|
$SecureStringPwd = 'Pqt8Q~E-dDmQugcPPWdaK2t_4retS41VVVVOZbOx' # $Secret:AzureVMServicePrincipal # $IaasAutoAzApp
|
|
$PSCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $AppId, ($SecureStringPwd | ConvertTo-SecureString -AsPlainText -Force)
|
|
Connect-AzAccount -ServicePrincipal -Credential $PSCredential -Tenant $tenantId
|
|
|
|
New-ITDWindowsVmAzure @params -Credential $PrvCred -Verbose |