嗨,有没有人知道为什么我会收到这个错误:
Got service connection details for Azure App Service:'nsclassroomstudent-dgyn27h2dfoyo'
##[debug][POST]https://login.windows.net/***/oauth2/token/
##[debug][GET]https://management.azure.com/subscriptions/237bc9da-22ad-49ea-8411-6cf6a190c18f/resourceGroups/ClassroomInTheCloud/providers/Microsoft.Web/sites/nsclassroomstudent-dgyn27h2dfoyo/?api-version=2016-08-01
##[debug]Correlation ID from ARM api call response : c3eefa7c-9088-44f1-8dc8-dccd7a9f8c4c
##[debug]Processed: ##vso[task.logissue type=error;code=ResourceNotFound;]
##[debug]Deployment Failed with Error: Error: Failed to fetch App Service 'nsclassroomstudent-dgyn27h2dfoyo' details. Error: The Resource 'Microsoft.Web/sites/nsclassroomstudent-dgyn27h2dfoyo' under resource group 'ClassroomInTheCloud' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix (CODE: 404)
##[debug]task result: Failed
附上我的代码,我已经通过微软网站:https ://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-app-service-settings?view=azure-devops
我已将连接的服务名称添加到我的 YAML 中,但我仍然收到错误,我不确定它还需要什么。
谢谢
#pool:
# vmImage: windows-latest
resources:
repositories:
- repository: Student
name: Classroom In The Cloud/Student
path:
- include: /Student/Student
type: git
ref: master #branch name
variables:
System.Debug: true
azureSubscription: 'azuresubscription'
RG: 'ClassroomInTheCloud'
Location: West Europe
containername: 'private'
appconnectionname: 'RunPipelinesInOtherSubscription'
jobs:
- job: job1
displayName: Create And Publish Artifact
pool:
vmImage: vs2017-win2016
steps:
- checkout: Student
clean: true
- task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
command: restore
projects: '**/*.csproj'
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
projects: '**/*.csproj'
workingDirectory: Student
- task: DotNetCoreCLI@2
displayName: dotnet publish
inputs:
command: publish
projects: '**/*.csproj'
arguments: --output "$(Build.ArtifactStagingDirectory)"
zipAfterPublish: true
modifyOutputPath: false
workingDirectory: Student
- task: PublishPipelineArtifact@1
displayName: Publish Pipeline Artifact
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifact: 'Student'
publishLocation: 'pipeline'
- job: job2
displayName: 'Get Variable Value for Student Env'
dependsOn: job1
steps:
- task: AzureCLI@1
displayName: 'Azure CLI '
inputs:
azureSubscription: $(azureSubscription)
scriptLocation: inlineScript
inlineScript: |
mkdir $(Pipeline.Workspace)\BlobFile
az storage blob download --container-name $(containername) --file '$(Pipeline.Workspace)/s/student.json' --name 'student.json' --connection-string 'DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=devscriptstorage;AccountKeyMY VALUE HERE'
- pwsh: |
cd '/home/vsts/work/1/s/'
ls
$armOutput = Get-Content '/home/vsts/work/1/s/student.json' | convertfrom-json
$student = $armOutput.studentvalue #use student not studentvalue
$type = $armOutput.type
$appServicePlanName = $armOutput.appServiceValue
Write-Host "The value of [$student] is [$appServicePlanName]"
Write-Host "##vso[task.setvariable variable=studentvalue;isOutput=true]$student" #use studentvalue not $studentvalue
Write-Host "##vso[task.setvariable variable=appServiceValue;isOutput=true]$appServicePlanName" #use appServiceValue not $appServicePlanName
name: setvarStep
- script: echo $(setvarStep.studentvalue)
- script: echo $(sevarStep.appServiceValue)
name: echovar
- job: job3
displayName: Create Web App
dependsOn: job2
variables:
webappname: $[ dependencies.job2.outputs['setvarStep.studentvalue'] ]
appservice: $[ dependencies.job2.outputs['setvarStep.appServicevalue'] ]
# Download Artifact File
steps:
- download: none
- task: DownloadPipelineArtifact@2
displayName: 'Download Build Artifacts'
inputs:
patterns: '**/*.zip'
path: '$(Build.ArtifactStagingDirectory)'
# deploy to Azure Web App
- task: AzureWebApp@1
inputs:
package: $(Build.ArtifactStagingDirectory)/**/*.zip
azureSubscription: $(azureSubscription)
appName: '$(webappname)'
ResourceGroupName: $(RG)
- task: AzureAppServiceSettings@1
inputs:
azureSubscription: $(azureSubscription)
ConnectedServiceName: $(appconnectionname)
appName: '$(webappname)'
resourceGroupName: $(RG)
# To deploy the settings on a slot, provide slot name as below. By default, the settings would be applied to the actual Web App (Production slot)
# slotName: staging
appSettings: |
{
"name": "DIAGNOSTICS_AZUREBLOBCONTAINERSASURL",
"value": "VALUEINHERE",
"slotSetting": false
},
{
"name": "DIAGNOSTICS_AZUREBLOBRETENTIONINDAYS",
"value": "365",
"slotSetting": false
},
{
"name": "OEM",
"value": "netsupport",
"slotSetting": false
},
{
"name": "SCM_REPOSITORY_PATH",
"value": "d:\\home\\respository",
"slotSetting": false
},
{
"name": "VIDEO_CLIENT_URL",
"value": "https://signal-uks.classroom.cloud",
"slotSetting": false
},
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "10.15.2",
"slotSetting": false
}