<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Azure Function &#8211; Pauls Blog</title>
	<atom:link href="https://sterl.org/tag/azure-function/feed/" rel="self" type="application/rss+xml" />
	<link>https://sterl.org</link>
	<description></description>
	<lastBuildDate>Fri, 10 Mar 2023 11:52:02 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
	<item>
		<title>Azure DevOps Function App Deployment &#8222;No package found&#8220;</title>
		<link>https://sterl.org/2023/03/azure-devops-function-app-deployment-no-package-found/</link>
					<comments>https://sterl.org/2023/03/azure-devops-function-app-deployment-no-package-found/#comments</comments>
		
		<dc:creator><![CDATA[Paul Sterl]]></dc:creator>
		<pubDate>Fri, 10 Mar 2023 11:06:46 +0000</pubDate>
				<category><![CDATA[CI/CD DevOps]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Azure Function]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[FunctionApp]]></category>
		<guid isPermaLink="false">https://sterl.org/?p=863</guid>

					<description><![CDATA[Problem This error occurs using the default MS deployment example. Even if we have an uploaded artefact Solution The problem is, that we have a deployment step by default but the MS documentation is outdated and so is missing the download step: As so we have to: Deploy Node Function App using Azure DevOps The&#8230;]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Problem</h2>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">##[error]Error: No package found with specified pattern: /home/vsts/work/1/a/**/*.zip
Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.
</pre></div>



<p>This error occurs using the default MS deployment example. Even if we have an uploaded artefact</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><a href="https://sterl.org/wp-content/uploads/2023/03/azure-package-deploy-function-app.png"><img decoding="async" src="https://sterl.org/wp-content/uploads/2023/03/azure-package-deploy-function-app.png" alt="" class="wp-image-866" width="237" height="129"/></a></figure></div>


<h2 class="wp-block-heading">Solution</h2>



<p>The problem is, that we have a deployment step by default but the MS documentation is outdated and so is missing the download step:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;yaml&quot;,&quot;mime&quot;:&quot;text/x-yaml&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;YAML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;yaml&quot;}">- task: DownloadBuildArtifacts@1
  inputs:
    buildType: 'current'
    downloadType: 'single'
    artifactName: 'drop'
    itemPattern: '**/*.zip'
    downloadPath: '$(System.ArtifactsDirectory)'</pre></div>



<p>As so we have to:</p>



<ol class="wp-block-list">
<li>build</li>



<li>publish -> <code>ArchiveFiles</code> &amp; <code>PublishBuildArtifacts</code></li>



<li><strong>download an artefact </strong>-> <code>DownloadBuildArtifacts</code></li>



<li>deploy: before we can trigger the deploy <code>AzureFunctionApp</code> task.</li>
</ol>



<h2 class="wp-block-heading">Deploy Node Function App using Azure DevOps</h2>



<p>The full build and deploy Azure DevOps scripts looks than like:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;yaml&quot;,&quot;mime&quot;:&quot;text/x-yaml&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;YAML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;yaml&quot;}"># Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
variables:
  # Azure service connection established during pipeline creation
  azureSubscription: '&lt;azure-subscription-name&gt;'
  appName: '&lt;azure-function-app-name&gt;'

trigger:
- master

pool:
  vmImage: ubuntu-latest

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '16.x'
  displayName: 'Install Node.js'
- script: |
    if [ -f extensions.csproj ]
    then
        dotnet build extensions.csproj --output ./bin
    fi
    npm install 
    npm run build --if-present
    npm prune --production  
- task: ArchiveFiles@2
  displayName: &quot;Archive files&quot;
  inputs:
    rootFolderOrFile: &quot;$(System.DefaultWorkingDirectory)&quot;
    includeRootFolder: false
    archiveFile: &quot;$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip&quot;
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip'
    artifactName: 'drop'
- task: DownloadBuildArtifacts@1
  inputs:
    buildType: 'current'
    downloadType: 'single'
    artifactName: 'drop'
    itemPattern: '**/*.zip'
    downloadPath: '$(System.ArtifactsDirectory)'
- task: AzureFunctionApp@1
  inputs:
    azureSubscription: $(azureSubscription)
    appType: functionAppLinux # default is functionApp
    appName: $(appName)
    package: '$(System.DefaultWorkingDirectory)/**/*.zip'
    runtimeStack: 'NODE|16' # this is optional
    deploymentMethod: 'auto' # auto is default
    #Uncomment the next lines to deploy to a deployment slot
    #Note that deployment slots is not supported for Linux Dynamic SKU
    #deployToSlotOrASE: true
    #resourceGroupName: '&lt;Resource Group Name&gt;'
    #slotName: '&lt;Slot name&gt;'</pre></div>



<h2 class="wp-block-heading">Links</h2>



<ul class="wp-block-list">
<li><a href="https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-azure-devops" target="_blank" rel="noreferrer noopener">CI/CD Microsoft Azure Pipeline Function App</a></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://sterl.org/2023/03/azure-devops-function-app-deployment-no-package-found/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
