在哪里可以获得我的实际 Azure 网站部署密码? [英] Where do I get my actual Azure Website Deployment password?

查看:23
本文介绍了在哪里可以获得我的实际 Azure 网站部署密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Visual Studio 2015 中,当我将我的网站/Web 应用程序发布到 Azure 时,我能够自动创建一个新的发布配置文件(通过输入我的个人 Azure 帐户凭据),这会创建 .pubxml.pubxml.user 文件.部署用户名采用$websiteName"形式,密码由一长串项目符号表示..pubxml.user 文件包含实际密码,该密码已加密,只有我的 Visual Studio 可以读取它,通过使用我的本地 Windows 用户帐户解密它 - 作为人类,我没有办法看见了.此外,.user 文件从源代码管理中排除(但 .pubxml 文件包含在源代码管理中).

In Visual studio 2015, when I Publish my Website/Webapp to Azure, I'm able to create a new publishing profile automatically (by entering my personal Azure account credentials), this creates the .pubxml and .pubxml.user files. The deployment username is of the form "$websiteName" and the password is represented by a long series of bullet points. The .pubxml.user file contains the actual password, which is encrypted such that only my Visual Studio can read it, by decrypting it with my local Windows user account - I, as a human, have no way to see it. Also, the .user files are excluded from Source Control (but the .pubxml files are included in Source Control).

当我团队中的另一个人尝试部署网站时,他们会获得相同的部署设置,但会提示输入$website"帐户的密码.我不知道从哪里获取此密码 - Azure 管理门户不显示它.

When another person on my team tries to deploy the website, they get the same deployment settings, but are prompted for the password for the "$website" account. I have no idea where to get this password from - the Azure Management portal does not display it.

如果此人打开门户并选择重置发布配置文件,则他们可以下载包含加密密码的新 .pubxml 文件,我知道只有他们的个人 Azure 凭据可以解密,但是这会破坏我和其他用户的部署,因为现在他们保存的密码(在 .user 文件中)已失效.

If the person opens the portal and chooses to Reset the publishing profile, then they can download a new .pubxml file that contains an encrypted password that I understand only their personal Azure credentials can decrypt, but that breaks deployment for me and other users because now their saved passwords (in the .user files) is invalidated.

我知道这是与 Azure 门户上的部署凭据"边栏选项卡不同的用户名+密码,因为目前该网站没有设置部署凭据,此外,如果我要设置一个,则用户名是不同的.门户网站声明这些凭据无论如何都用于 FTP 访问 - 没有提及 Web 部署功能.

I understand this is a different username+password to the "Deployment Credentials" blade on the Azure portal because currently the website has no Deployment Credentials set, in addition if I were to set one, the username is different. The Portal states that those credentials are for FTP access anyway - no mention is made of the Web Deploy feature.

推荐答案

您可以通过 Portal 或 PowerShell/CLI 获取当前凭据.

You can get the current credentials via the Portal or PowerShell/CLI.

在门户上,webapp 刀片顶部有一个按钮,用于下载发布配置文件(不是部署凭据刀片,而是主 Web 应用刀片).

On the portal, there is a button at the top of the webapp blade to download the publish profile (not the deployment credentials blade, but the main web app blade).

首先,确保安装了 Azure PowerShell cmdlet:https://docs.microsoft.com/en-us/powershell/azure/install-azurerm-ps?view=azurermps-6.3.0

First, ensure the Azure PowerShell cmdlets are installed: https://docs.microsoft.com/en-us/powershell/azure/install-azurerm-ps?view=azurermps-6.3.0

  1. 打开一个提升的 PowerShell 窗口.
  2. 输入 $PSVersionTable.PSVersion.确保输出显示您拥有主要版本 5 或更高版本.如果这个命令给你一个错误,那么你正在运行 PowerShell v1,它在这一点上是古老的.
  3. 输入 Install-Module -Name AzureRM(可能会提示您更新 NuGet,在这种情况下您应该)
  4. 等待它完成安装.
  5. 输入Import-Module AzureRM
  6. 输入 Connect-AzureRmAccount 并完成身份验证过程.
  7. 运行此命令将发布配置文件保存到磁盘上的文件(为了可读性添加了换行符,实际上将其放在一行中).根据需要设置 $WebAppName$ResourceGroupName:

  1. Open an elevated PowerShell window.
  2. Enter $PSVersionTable.PSVersion. Ensure the output shows you have Major version 5 or later. If this command gives you an error then you're running PowerShell v1 which is ancient at this point.
  3. Enter Install-Module -Name AzureRM (you may be prompted to update NuGet, in which case you should)
  4. Wait for it to finish installing.
  5. Enter Import-Module AzureRM
  6. Enter Connect-AzureRmAccount and complete the authentication process.
  7. Run this command to save the publishing profile to a file on disk (line-breaks added for readability, in reality put this on a single line). Set $WebAppName and $ResourceGroupName as appropriate:

Get-AzureRmWebAppPublishingProfile
    -ResourceGroupName $ResourceGroupName
    -Name $WebAppName
    -OutputFile creds.xml
    -Format WebDeploy

.publishsettings 文件

.publishsettings 文件是一个 XML 文件(没有换行符).在里面你会找到一个具有这种结构的文档.在带有 publishMethod="MSDeploy" 元素中查找 userPWD 属性.不要使用 FTP 凭据(在第二个 元素中),因为用户名不同.

.publishsettings file

The .publishsettings file is an XML file (without line-breaks). Inside you'll find a document with this structure. Look for the userPWD attribute in the <publishProfile> element with publishMethod="MSDeploy". Don't use the FTP credentials (in the second <publishProfile> element) because the username is different.

userPWD 属性值未加密,而是完全随机字节的 base64(或 base62?)编码.您可以将此值直接复制并粘贴到 Visual Studio 发布向导中的凭据提示中.

The userPWD attribute value is not encrypted, but is the base64 (or base62?) encoding of completely random bytes. You can copy and paste this value directly into the credential prompt within Visual Studio's publishing wizard.

<publishData>
    <publishProfile
        profileName="SITE - Web Deploy"
        publishMethod="MSDeploy"
        publishUrl="SITE.scm.azurewebsites.net:443"
        msdeploySite="SITE"
        userName="$SITE"
        userPWD="YOUR PASSWORD IS HERE"                    <-- This attribute here
        destinationAppUrl="http://SITE.azurewebsites.net"
        SQLServerDBConnectionString=""
        mySQLDBConnectionString=""
        hostingProviderForumLink=""
        controlPanelLink=""
        webSystem="WebSites"
    >
        <databases />
    </publishProfile>

    <publishProfile
        profileName="SITE - FTP"
        publishMethod="FTP"
        publishUrl="ftp://SITE.ftp.azurewebsites.windows.net/site/wwwroot"
        ftpPassiveMode="True"
        userName="SITE$SITE"
        userPWD="FTP PASSWORD IS HERE"
        destinationAppUrl="http://SITE.azurewebsites.net"
        SQLServerDBConnectionString=""
        mySQLDBConnectionString=""
        hostingProviderForumLink=""
        controlPanelLink=""
        webSystem="WebSites"
    >
        <databases />
    </publishProfile>
</publishData>

这篇关于在哪里可以获得我的实际 Azure 网站部署密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆