지금 당신이
$thumbprint = $s.DefaultAccount
대신
#$thumbprint = $s.Certificate.Thumbprint
의 사용하여 인증서 지문에 액세스 할 수 있는지 보인다에서 DefaultAccount이 인증서 지문과 정확히 같은 값을 것 같다.
Function get-AzureWebSitePublishXml
{
Param(
[Parameter(Mandatory = $true)]
[String]$WebsiteName
)
# Get the current subscription
$s = Get-AzureSubscription -Current
if (!$s) {throw "Cannot get Windows Azure subscription."}
#$thumbprint = $s.Certificate.Thumbprint #this code doesn't work anymore
$thumbprint = $s.DefaultAccount
if (!$thumbprint) { throw "Cannot get subscription cert thumbprint."}
# Get the certificate of the current subscription from your local cert store
$cert = Get-ChildItem Cert:\CurrentUser\My\$thumbprint
if (!$cert) {throw "Cannot find subscription cert in Cert: drive."}
$website = Get-AzureWebsite -Name $WebsiteName
if (!$website) {throw "Cannot get Windows Azure website: $WebsiteName."}
# Compose the REST API URI from which you will get the publish settings info
$uri = "https://management.core.windows.net:8443/{0}/services/WebSpaces/{1}/sites/{2}/publishxml" -f `
$s.SubscriptionId, $website.WebSpace, $Website.Name
# Get the publish settings info from the REST API
$publishSettings = Invoke-RestMethod -Uri $uri -Certificate $cert -Headers @{"x-ms-version" = "2013-06-01"}
if (!$publishSettings) {throw "Cannot get Windows Azure website publishSettings."}
return $publishSettings
}
참고 : 그냥 여기 참조
는 특정 웹 사이트에 대한 게시 프로파일을 얻기 위해 내 전체 스크립트 당신이 가져 오기 - AzurePublishSettingsFile를 사용하여 푸른에 연결 한 경우에만 작동합니다
사람이 수 DefaultAccount
속성을 사용하는 것이 안전한지 확인하십시오. 당신이 당신의 위치, like this을 업로드 Kudu API를 사용하는 경우
UPDATE
, 당신은 어떤 인증서 또는 공개 프로필이 필요하지 않습니다. Get-AzureWebsite
을 사용하여 사용자 이름과 암호를 읽고 호스트 이름은 yourwebsitename.scm.azurewebsites.net
입니다 (scm 세그먼트에주의하십시오). Kudu를 사용하는 것이 훨씬 더 빠르고 안정적이기 때문에 제안합니다.
다른 대안은 SCM (Kudu) 사이트를 통해 파일을 배포하는 것입니다. 사용 가능한 REST API (https://github.com/projectkudu/kudu/wiki/REST-API)를 참조하십시오. 구체적으로는 VFS 또는 Zip입니다. 여전히 문제가 있다면 알려주십시오. –
@SuwatCh 감사합니다. Kudu는 매우 흥미로운 대안 인 것 같습니다! –
@SuwatCh kudu를 사용하여 종료되었습니다. 여기 [내 요점] (https://gist.github.com/davideicardi/a8247230515177901e57) –