<?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 &#8211; Pauls Blog</title>
	<atom:link href="https://sterl.org/tag/azure/feed/" rel="self" type="application/rss+xml" />
	<link>https://sterl.org</link>
	<description></description>
	<lastBuildDate>Tue, 09 May 2023 08:06:35 +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 Bicep CLI and functions cheet sheet</title>
		<link>https://sterl.org/2023/03/azure-bicep-cli-functions-cheet-sheet/</link>
					<comments>https://sterl.org/2023/03/azure-bicep-cli-functions-cheet-sheet/#respond</comments>
		
		<dc:creator><![CDATA[Paul Sterl]]></dc:creator>
		<pubDate>Fri, 31 Mar 2023 15:06:05 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[CI/CD DevOps]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[bicep]]></category>
		<category><![CDATA[ci/cd]]></category>
		<category><![CDATA[IaC]]></category>
		<category><![CDATA[infrastructure-as-code]]></category>
		<guid isPermaLink="false">https://sterl.org/?p=890</guid>

					<description><![CDATA[Overall Azure bicep is the best repalcement for AWS CDK currently available (2023) and the recommended way to express infrastructure-as-code in the aure universe. Bicep CLI All command require azure CLI and PowerShell 7.x.x Select subscription by name / set context Set default Run bicep deployment Read resource group List resource groups Bicep functions Random&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Overall Azure <code>bicep</code> is the best repalcement for <code>AWS CDK</code> currently available (2023) and the recommended way to express infrastructure-as-code in the aure universe.</p>



<h2 class="wp-block-heading">Bicep CLI</h2>



<p>All command require azure CLI and PowerShell 7.x.x</p>



<h3 class="wp-block-heading">Select subscription by name / set context</h3>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;file&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;powershell&quot;,&quot;mime&quot;:&quot;application/x-powershell&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;PowerShell&quot;,&quot;language&quot;:&quot;PowerShell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;powershell&quot;}">$context = Get-AzSubscription -SubscriptionName '&lt;name of the subscription&gt;'
Set-AzContext $context</pre></div>



<h3 class="wp-block-heading">Set default </h3>



<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;powershell&quot;,&quot;mime&quot;:&quot;application/x-powershell&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;PowerShell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;powershell&quot;}">Set-AzDefault -ResourceGroupName &lt;resource-group-name&gt;</pre></div>



<h3 class="wp-block-heading">Run bicep deployment</h3>



<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;powershell&quot;,&quot;mime&quot;:&quot;application/x-powershell&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;PowerShell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;powershell&quot;}">New-AzResourceGroupDeployment -TemplateFile main.bicep</pre></div>



<h3 class="wp-block-heading">Read resource group</h3>



<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;powershell&quot;,&quot;mime&quot;:&quot;application/x-powershell&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;PowerShell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;powershell&quot;}">Get-AzResourceGroupDeployment -ResourceGroupName &lt;resource-group-name&gt; | Format-Table</pre></div>



<h3 class="wp-block-heading">List resource groups</h3>



<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;powershell&quot;,&quot;mime&quot;:&quot;application/x-powershell&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;PowerShell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;powershell&quot;}">Get-AzResourceGroup</pre></div>



<h2 class="wp-block-heading">Bicep functions</h2>



<h3 class="wp-block-heading">Random unique name <a href="https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions-string#uniquestring" target="_blank" rel="noreferrer noopener">uniqueString</a></h3>



<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;javascript&quot;,&quot;mime&quot;:&quot;text/javascript&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;JavaScript&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;js&quot;}">param fooUniceName string = 'fooo${uniqueString('constant-seed-value')}'</pre></div>



<h2 class="wp-block-heading">Create resource group with bicep</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;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;}">targetScope = 'subscription'
param location string = deployment().location

resource rg 'Microsoft.Resources/resourceGroups@2022-09-01' = {
    name: 'myName'
    location: location
}</pre></div>



<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;powershell&quot;,&quot;mime&quot;:&quot;application/x-powershell&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;PowerShell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;powershell&quot;}">az deployment create --location westeurope  --template-file .\main.bicep</pre></div>



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



<ul class="wp-block-list">
<li><a href="https://learn.microsoft.com/en-us/powershell/module/az.resources">https://learn.microsoft.com/en-us/powershell/module/az.resources</a></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://sterl.org/2023/03/azure-bicep-cli-functions-cheet-sheet/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Azure Node Functions Apps and OpenAPI Swagger</title>
		<link>https://sterl.org/2023/03/azure-node-functions-apps-and-openapi-swagger/</link>
					<comments>https://sterl.org/2023/03/azure-node-functions-apps-and-openapi-swagger/#respond</comments>
		
		<dc:creator><![CDATA[Paul Sterl]]></dc:creator>
		<pubDate>Sun, 12 Mar 2023 09:15:26 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[OpenAPI]]></category>
		<category><![CDATA[swagger-ui]]></category>
		<guid isPermaLink="false">https://sterl.org/?p=875</guid>

					<description><![CDATA[Sometimes we face the problem that we want to host a very simple web-service including a swagger-ui / OpenApi-UI. The question now is, what is the simplest solution, which works everywhere, even in a azure function app? Where are of course some libs etc. which on the other hand require us to run the web-server.&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Sometimes we face the problem that we want to host a very simple web-service including a swagger-ui / <a rel="noreferrer noopener" href="https://swagger.io/docs/open-source-tools/swagger-ui/usage/installation/" data-type="URL" data-id="https://swagger.io/docs/open-source-tools/swagger-ui/usage/installation/" target="_blank">OpenApi-UI</a>. The question now is, what is the simplest solution, which works everywhere, even in a azure function app?</p>



<p>Where are of course some libs etc. which on the other hand require us to run the web-server. If we look into the doc using the simple <strong>unpkg </strong>HTML files looks like to be the simplest solution.</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;htmlmixed&quot;,&quot;mime&quot;:&quot;text/html&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;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot; /&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot; /&gt;
  &lt;meta
    name=&quot;description&quot;
    content=&quot;SwaggerUI&quot;
  /&gt;
  &lt;title&gt;SwaggerUI&lt;/title&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;https://unpkg.com/swagger-ui-dist@4.5.0/swagger-ui.css&quot; /&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;swagger-ui&quot;&gt;&lt;/div&gt;
&lt;script src=&quot;https://unpkg.com/swagger-ui-dist@4.5.0/swagger-ui-bundle.js&quot; crossorigin&gt;&lt;/script&gt;
&lt;script&gt;
  window.onload = () =&gt; {
    window.ui = SwaggerUIBundle({
      url: 'https://petstore3.swagger.io/api/v3/openapi.json',
      dom_id: '#swagger-ui',
    });
  };
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div>



<h3 class="wp-block-heading">What needs to be done</h3>



<ul class="wp-block-list">
<li>Get the HTML OpenAPI HTML file</li>



<li>Provide an OpenAPI YML or JSON</li>



<li>Create an endpoint which should host the doc</li>
</ul>



<p>This solution works also for a spring web app or a AWS function. We will go ahead and look into a Node JavaScript example to see how it may look like:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://sterl.org/wp-content/uploads/2023/03/azure-function-app-open-api-doc.png"><img fetchpriority="high" decoding="async" width="271" height="200" src="https://sterl.org/wp-content/uploads/2023/03/azure-function-app-open-api-doc.png" alt="" class="wp-image-876"/></a></figure></div>


<p>Which means we have to create a new azure function endpoint where we want to host the OpenApi-UI:</p>



<h3 class="wp-block-heading">function.json</h3>



<p>We can set the function to &#8222;anonymous&#8220; if we like and only get is required:</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;javascript&quot;,&quot;mime&quot;:&quot;application/json&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;JSON&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;json&quot;}">{
  &quot;bindings&quot;: [
    {
      &quot;authLevel&quot;: &quot;anonymous&quot;,
      &quot;type&quot;: &quot;httpTrigger&quot;,
      &quot;direction&quot;: &quot;in&quot;,
      &quot;name&quot;: &quot;req&quot;,
      &quot;methods&quot;: [
        &quot;get&quot;
      ]
    },
    {
      &quot;type&quot;: &quot;http&quot;,
      &quot;direction&quot;: &quot;out&quot;,
      &quot;name&quot;: &quot;res&quot;
    }
  ]
}</pre></div>



<h3 class="wp-block-heading">openApi.html</h3>



<p>The only adjustment to the original HTML file is the source of the <code>yml</code> or <code>json</code> file. You could also adjust the JS and CSS url:</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;htmlmixed&quot;,&quot;mime&quot;:&quot;text/html&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;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot; /&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot; /&gt;
  &lt;meta name=&quot;description&quot; content=&quot;My SwaggerUI&quot; /&gt;
  &lt;title&gt;SwaggerUI&lt;/title&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;https://unpkg.com/swagger-ui-dist@4.5.0/swagger-ui.css&quot; /&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;swagger-ui&quot;&gt;&lt;/div&gt;
&lt;script src=&quot;https://unpkg.com/swagger-ui-dist@4.5.0/swagger-ui-bundle.js&quot; crossorigin&gt;&lt;/script&gt;
&lt;script&gt;
  window.onload = () =&gt; {
    window.ui = SwaggerUIBundle({
      url: './doc?file=openApi.yml',
      dom_id: '#swagger-ui',
    });
  };
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div>



<h3 class="wp-block-heading">openApi.yml</h3>



<p>Just as an example here. Note here the <code>URL</code> which has a funny value of <code>_server.url_</code>, we will replace this value later.</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;}">openapi: 3.0.2
info:
  title: My OpenAPI
  version: v1
servers:
  - url: &quot;_server.url_&quot;
paths:
  /foo:
    get:
      summary: Som cool function
      responses:
        '200':
          description: Retrieved entities
          content:
            application/json:
              schema:
                type: string</pre></div>



<h3 class="wp-block-heading">index.js</h3>



<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;javascript&quot;,&quot;mime&quot;:&quot;text/javascript&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;JavaScript&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;js&quot;}">&quot;use strict&quot;;
const fs = require('fs');
const util = require('util');
const readFileAsync = util.promisify(fs.readFile);

module.exports = async function (context, req) {
    switch(req.query.file) {
        case 'openApi.yml':
            // get the url and remove the doc suffix, azure specific
            const url = req.headers.referer.replace('/doc', '');
            let yml = await readFileAsync('doc/openApi.yml', 'UTF-8');
            yml = yml.replace('_server.url_', url);
            context.res = {
                body: yml,
                headers: {
                    &quot;Content-Type&quot;: &quot;application/yml; charset=utf-8&quot;
                }
            };
            break;
        default:
            context.res = {
                body: await readFileAsync('doc/openApi.html', 'UTF-8'),
                headers: {
                    &quot;Cache-Control&quot;: &quot;max-age=600&quot;, // optional cache header
                    &quot;Content-Type&quot;: &quot;text/html; charset=utf-8&quot;
                }
            };
            break;
    }
}</pre></div>



<p>The switch case is where to ensure we load only files we want to publish, as so you have to extend the case block if you want to host the JS files too. Of course they have to be added to your directory.</p>



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



<ul class="wp-block-list">
<li><a href="https://swagger.io/docs/open-source-tools/swagger-ui/usage/installation/">https://swagger.io/docs/open-source-tools/swagger-ui/usage/installation/</a></li>



<li><a href="https://learn.microsoft.com/de-de/azure/azure-functions/functions-reference-node?t#use-async-and-await">https://learn.microsoft.com/de-de/azure/azure-functions/functions-reference-node?t#use-async-and-await</a></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://sterl.org/2023/03/azure-node-functions-apps-and-openapi-swagger/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<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>
