Last active
September 20, 2017 17:36
-
-
Save jimmyca15/223799a9a05c073d899049e110ca7872 to your computer and use it in GitHub Desktop.
Azure Scale Set Script Extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
[Parameter(Mandatory=$true)] | |
[String] $StorageAccountName, | |
[Parameter(Mandatory=$true)] | |
[String] $StorageAccountKey, | |
[Parameter(Mandatory=$true)] | |
[String] $DriveLetter, | |
[Parameter(Mandatory=$true)] | |
[String] $FileShareLocation, | |
[Parameter(Mandatory=$true)] | |
[String] $SharedConfigPath, | |
[Parameter(Mandatory=$true)] | |
[String] $ConfigKeyPassword, | |
[Parameter(Mandatory=$true)] | |
[String] $CertStorePath, | |
[Parameter(Mandatory=$true)] | |
[String] $CertStoreKeyPassword | |
) | |
# Add file share user | |
net user $StorageAccountName $StorageAccountKey /ADD /Y | |
# Mount Azure File Share as drive | |
net use "$($DriveLetter):" $FileShareLocation /u:$StorageAccountName $StorageAccountKey /PERSISTENT:YES | |
# Enable IIS Shared Configuration | |
$PhysicalPath = [System.IO.Path]::Combine($FileShareLocation, $SharedConfigPath) | |
$kp = ConvertTo-SecureString -AsPlainText -Force $ConfigKeyPassword | |
$pass = ConvertTo-SecureString -AsPlainText -Force $StorageAccountKey | |
Enable-IISSharedConfig -Username $StorageAccountName -Password $pass -KeyEncryptionPassword $kp -PhysicalPath $PhysicalPath -Force | |
# Enable IIS Central Certificate Store | |
$CertsPass = ConvertTo-SecureString -AsPlainText -Force $CertStoreKeyPassword | |
$CertStoreLocation = [System.IO.Path]::Combine($FileShareLocation, $CertStorePath) | |
Enable-IISCentralCertProvider -UserName $StorageAccountName -Password $pass -CertStoreLocation $CertStoreLocation -PrivateKeyPassword $CertsPass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment