@@ -26,15 +26,15 @@ This script is meant to be called from an ARM template.
2626#>
2727[CmdletBinding ()]
2828param (
29- [Parameter (Mandatory = $true )]
29+ [Parameter ( Mandatory = $true )]
3030 [string ] $DeploymentGuid ,
3131 [Parameter (Mandatory = $true )]
3232 [string ] $OMSWorkspaceID ,
3333 [Parameter (Mandatory = $true )]
3434 [string ] $OMSSharedKey ,
35- [Parameter (Mandatory = $true )]
35+ [Parameter (ParameterSetName = ' AdminAccount ' , Mandatory = $true )]
3636 [string ] $azureStackAdminUsername ,
37- [Parameter (Mandatory = $true )]
37+ [Parameter (ParameterSetName = ' AdminAccount ' , Mandatory = $true )]
3838 [string ] $azureStackAdminPassword ,
3939 [Parameter (Mandatory = $true )]
4040 [string ] $CloudName ,
@@ -43,11 +43,19 @@ param(
4343 [Parameter (Mandatory = $true )]
4444 [string ] $Fqdn ,
4545 [Parameter (Mandatory = $true )]
46- [string ] $Oem
46+ [string ] $Oem ,
47+ [Parameter (ParameterSetName = ' CertSPN' , Mandatory = $true )]
48+ [string ] $CertificateThumbprint ,
49+ [Parameter (ParameterSetName = ' CertSPN' , Mandatory = $true )]
50+ [string ] $ApplicationId ,
51+ [Parameter (ParameterSetName = ' CertSPN' , Mandatory = $true )]
52+ [string ] $TenantId
4753
4854)
49-
50- $azureStackAdminPasswordSecureString = $azureStackAdminPassword | ConvertTo-SecureString - Force - AsPlainText
55+ if ($pscmdlet.ParameterSetName -eq " AdminAccount" )
56+ {
57+ $azureStackAdminPasswordSecureString = $azureStackAdminPassword | ConvertTo-SecureString - Force - AsPlainText
58+ }
5159
5260cd c:\
5361
@@ -74,26 +82,49 @@ Install-Module -Name Azs.Infrastructureinsights.Admin -Force
7482Install-Module - Name Azs.Update.Admin - Force
7583Install-Module - Name Azs.Fabric.Admin - Force
7684
77- # store data required by scheduled task in files.
78- $info = @ {
79- DeploymentGuid = $DeploymentGuid ;
80- CloudName = $CloudName ;
81- Region = $Region ;
82- Fqdn = $Fqdn ;
83- OmsWorkspaceID = $OMSWorkspaceID ;
84- OmsSharedKey = $OMSSharedKey ;
85- AzureStackAdminUsername = $azureStackAdminUsername ;
86- AzureStackAdminPassword = $azureStackAdminPassword ;
87- Oem = $Oem ;
85+
86+ Switch ($pscmdlet.ParameterSetName )
87+ {
88+ " AdminAccount" {
89+ # store data required by scheduled task to use AdminAccount in files.
90+ $info = @ {
91+ ParameterSet = $pscmdlet.ParameterSetName ;
92+ DeploymentGuid = $DeploymentGuid ;
93+ CloudName = $CloudName ;
94+ Region = $Region ;
95+ Fqdn = $Fqdn ;
96+ OmsWorkspaceID = $OMSWorkspaceID ;
97+ OmsSharedKey = $OMSSharedKey ;
98+ Oem = $Oem ;
99+ AzureStackAdminUsername = $azureStackAdminUsername ;
100+
101+ }
102+ # store passwords in txt files.
103+ $passwordText = $azureStackAdminPasswordSecureString | ConvertFrom-SecureString
104+ Set-Content - Path " C:\AZSAdminOMSInt\azspassword_$CloudName .txt" - Value $passwordText
105+ }
106+
107+ " CertSPN" {
108+ # store data required by scheduled task to use CertSPN in files.
109+ $info = @ {
110+ ParameterSet = $pscmdlet.ParameterSetName ;
111+ DeploymentGuid = $DeploymentGuid ;
112+ CloudName = $CloudName ;
113+ Region = $Region ;
114+ Fqdn = $Fqdn ;
115+ OmsWorkspaceID = $OMSWorkspaceID ;
116+ OmsSharedKey = $OMSSharedKey ;
117+ Oem = $Oem ;
118+ CertificateThumbprint = $CertificateThumbprint ;
119+ ApplicationId = $ApplicationId ;
120+ TenantId = $TenantId ;
121+ }
122+ }
88123}
89124
90125$infoJson = ConvertTo-Json $info
91126Set-Content - Path " C:\AZSAdminOMSInt\info_$CloudName .txt" - Value $infoJson
92127
93- # store passwords in txt files.
94- $passwordText = $azureStackAdminPasswordSecureString | ConvertFrom-SecureString
95- Set-Content - Path " C:\AZSAdminOMSInt\azspassword_$CloudName .txt" - Value $passwordText
96-
97128
98129# Download Azure Stack Tools VNext
99130cd c:\AZSAdminOMSInt
0 commit comments