使用 PowerShell 为新的 Azure 门户获取网站的 PublishingPassword
Get PublishingPassword for website with PowerShell for new Azure portal
我曾经使用 Get-AzureWebsite -Name myportal
获取 PublishingPassword
我可以在内部使用的内容 Visual Studio 将 WebApp 发布到云端。
但现在我被分配了一个新的 azure 订阅,旧的 azure 命令集(即 Get-AzureSubscription
)看不到它。
但是 Get-AzureRmSubscription
(使用 "Rm" 关键字)可以看到此订阅。但是 Get-AzureRmWebApp
不包含 PublishingPassword
属性.
是否有任何其他方法可以使用新命令集(包含 "Rm")获得 PublishingPassword
。
您要查找的cmdlet 是Get-AzureRmWebAppPublishingProfile
当时我在寻找更直接的方法,但没有找到。这有点令人费解,但它确实有效。 (它实际上并没有向文件写入任何内容,但我记得如果不包含它就会窒息)
这就是我用它做的...
function Get-FTPCredentials
{
$Xml = [xml](Get-AzureRmWebAppPublishingProfile -OutputFile test.xml -Format Ftp -ResourceGroupName $AppServiceResourceGroupName -Name $AppServiceWebAppName )
$PublishProfile = $Xml.FirstChild.ChildNodes[1]
Write-Output ("FTP location is - " + $PublishProfile.publishUrl)
Write-Output ("FTP username is - " + $PublishProfile.userName)
Write-Output ("FTP password is - " + $PublishProfile.userPWD)
Write-Output ("Website URL is - " + $PublishProfile.destinationAppUrl)
}
获取通过 Visual Studio 发布的 Azure 网站的发布密码 (PublishingPassword
) 的快速流程 - 使用 PowerShell 控制台手动获取:
Add-AzureRmAccount -TenantId 12343048-34cb-4322-b413-7b408837xxxx
Get-AzureRmWebAppPublishingProfile -Name myPortal -OutputFile test.xml -ResourceGroupName MyResourcesTestGroup
第一个命令将登录设置为所需的租户(目录)(即将您的 Azure 帐户添加到 PowerShell 会话)。其次获取网站 (webapp) 对象并打印包括密码在内的发布数据。
我曾经使用 Get-AzureWebsite -Name myportal
获取 PublishingPassword
我可以在内部使用的内容 Visual Studio 将 WebApp 发布到云端。
但现在我被分配了一个新的 azure 订阅,旧的 azure 命令集(即 Get-AzureSubscription
)看不到它。
但是 Get-AzureRmSubscription
(使用 "Rm" 关键字)可以看到此订阅。但是 Get-AzureRmWebApp
不包含 PublishingPassword
属性.
是否有任何其他方法可以使用新命令集(包含 "Rm")获得 PublishingPassword
。
您要查找的cmdlet 是Get-AzureRmWebAppPublishingProfile
当时我在寻找更直接的方法,但没有找到。这有点令人费解,但它确实有效。 (它实际上并没有向文件写入任何内容,但我记得如果不包含它就会窒息)
这就是我用它做的...
function Get-FTPCredentials
{
$Xml = [xml](Get-AzureRmWebAppPublishingProfile -OutputFile test.xml -Format Ftp -ResourceGroupName $AppServiceResourceGroupName -Name $AppServiceWebAppName )
$PublishProfile = $Xml.FirstChild.ChildNodes[1]
Write-Output ("FTP location is - " + $PublishProfile.publishUrl)
Write-Output ("FTP username is - " + $PublishProfile.userName)
Write-Output ("FTP password is - " + $PublishProfile.userPWD)
Write-Output ("Website URL is - " + $PublishProfile.destinationAppUrl)
}
获取通过 Visual Studio 发布的 Azure 网站的发布密码 (PublishingPassword
) 的快速流程 - 使用 PowerShell 控制台手动获取:
Add-AzureRmAccount -TenantId 12343048-34cb-4322-b413-7b408837xxxx
Get-AzureRmWebAppPublishingProfile -Name myPortal -OutputFile test.xml -ResourceGroupName MyResourcesTestGroup
第一个命令将登录设置为所需的租户(目录)(即将您的 Azure 帐户添加到 PowerShell 会话)。其次获取网站 (webapp) 对象并打印包括密码在内的发布数据。