...
Copy the below PowerShell script into the text editor of your choice and save it as
zipdeploy_appService.ps1
.Code Block language powershell param( $pubProfileFilePath ,$zipFilePath ,$authority_url = $null ,$client_id = $null ,$scope = $null ,$api_url = $null ,$base_eid_url = $null ) $ErrorActionPreference = "Stop" $pubProfile = [xml](gc $pubProfileFilePath) $zipPubProfile = $pubProfile.publishData.publishProfile | where { $_.publishMethod -eq "zipdeploy" } $userAgent = "powershell/1.0" $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $zipPubProfile.userName, $zipPubProfile.userPWD))) $zipdeployUrl = "https://$($zipPubProfile.publishUrl)/api/zipdeploy" $deploymentsUrl = "https://$($zipPubProfile.publishUrl)/api/deployments" $tempDir = [System.IO.Path]::GetTempPath() + $(New-Guid) $tempZipFile = $tempDir + ".zip" [System.IO.Directory]::CreateDirectory($tempDir) | Out-Null Expand-Archive -Path $zipFilePath -DestinationPath $tempDir if([System.IO.File]::Exists("$tempDir\index.html")){ $raw = [System.IO.File]::ReadAllText("$tempDir\index.html") $editted = $false if($raw.Contains("#{AUTHORITY_URL}#") -and ![String]::IsNullOrWhiteSpace($authority_url)){ $raw = $raw.Replace("#{AUTHORITY_URL}#", $authority_url) $editted = $true } if($raw.Contains("#{CLIENT_ID}#") -and ![String]::IsNullOrWhiteSpace($client_id)){ $raw = $raw.Replace("#{CLIENT_ID}#", $client_id) $editted = $true } if($raw.Contains("#{SCOPE}#") -and ![String]::IsNullOrWhiteSpace($scope)){ $raw = $raw.Replace("#{SCOPE}#", $scope) $editted = $true } if($raw.Contains("#{API_URL}#") -and ![String]::IsNullOrWhiteSpace($api_url)){ $raw = $raw.Replace("#{API_URL}#", $api_url) $editted = $true } if($raw.Contains("#{BASE_EID_URL}#") -and ![String]::IsNullOrWhiteSpace($base_eid_url)){ $raw = $raw.Replace("#{BASE_EID_URL}#", $base_eid_url) $editted = $true } if($editted -eq $true){ [System.IO.File]::WriteAllText("$tempDir\index.html", $raw) } } Compress-Archive -Path $tempDir\* -DestinationPath $tempZipFile [System.IO.Directory]::Delete($tempDir, $true) Invoke-RestMethod -Uri $zipdeployUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -UserAgent $userAgent -Method Post -InFile $tempZipFile [System.IO.File]::Delete($tempZipFile)$zipFilePath Invoke-RestMethod -Uri $deploymentsUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -UserAgent $userAgent -Method Get
Open an administrative PowerShell session.
Navigate to the directory where you saved the script and execute the script, passing in the values of the
pubProfilePath
andzipFilePath
parameters via the command line, where the value ofpubProfilePath
is the path to the SCIM App Service Publisher Profile Settings file you downloaded from Azure, and the value ofzipFilePath
is the path to the microservice ZIP file you received from EmpowerID.
The command to execute the script should look similar to that shown in the below image.
...