-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDownloadPublishProfileForWebApp.ps1
40 lines (27 loc) · 1.37 KB
/
DownloadPublishProfileForWebApp.ps1
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
$webAppName = "powershelldemowebapp"
$subscriptionId = "31af7401-5a70-49be-80c7-7a6b85da7287"
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId $subscriptionId
$rgName = GetResourceGroupForWebApp $webAppName
$publishProfileString = Invoke-AzureRmResourceAction -ResourceGroupName $rgName `
-ResourceType Microsoft.Web/sites `
-ResourceName $webAppName `
-Action publishxml `
-ApiVersion 2015-08-01 -Force
$publishProfileString | Out-File -FilePath c:\temp\publishprofile.xml
notepad.exe c:\temp\publishprofile.xml
$publishProfileXml =[xml]$publishProfileString
$webDeployPublishUrl = $publishProfileXml.publishData.publishProfile[0].publishUrl
$webDeployPublishUserName = $publishProfileXml.publishData.publishProfile[0].userName
$webDeployPublishPassword = $publishProfileXml.publishData.publishProfile[0].userPWD
$ftpPublishUrl = $publishProfileXml.publishData.publishProfile[1].publishUrl
$ftpPublishUserName = $publishProfileXml.publishData.publishProfile[1].userName
$ftpPublishPassword = $publishProfileXml.publishData.publishProfile[1].userPWD
"webDeployPublishUrl = " + $webDeployPublishUrl
"webDeployPublishUserName = " + $webDeployPublishUserName
"webDeployPublishPassword = " + $webDeployPublishPassword
"ftpPublishUrl = " + $ftpPublishUrl
"ftpPublishUserName = " + $ftpPublishUserName
"ftpPublishPassword = " + $ftpPublishPassword