<?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 Container &#8211; Sibeesh Passion</title>
	<atom:link href="https://www.sibeeshpassion.com/tag/azure-container/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Wed, 24 Jul 2019 15:24:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>Azure Container &#8211; Sibeesh Passion</title>
	<link>https://www.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Azure Function Job to Delete Azure Blobs from Blob Containers</title>
		<link>https://www.sibeeshpassion.com/azure-function-job-to-delete-azure-blobs-from-blob-containers/</link>
					<comments>https://www.sibeeshpassion.com/azure-function-job-to-delete-azure-blobs-from-blob-containers/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 24 Jul 2019 15:24:49 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Azure Automation with Azure Function]]></category>
		<category><![CDATA[Azure Blob]]></category>
		<category><![CDATA[Azure Container]]></category>
		<category><![CDATA[Azure Function]]></category>
		<category><![CDATA[Azure Job]]></category>
		<category><![CDATA[Azure Storage]]></category>
		<category><![CDATA[Delete blobs using Azure Function]]></category>
		<category><![CDATA[Serverless]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=13852</guid>

					<description><![CDATA[[toc] Introduction I have tried many things with Azure Functions and you should be able to see then here. Here in this post we are going to see how we can create a job which runs in a particular day and time to delete the blobs we have in a blob containers in our Azure Storage Account. If you want to know how you can upload to the blobs using Azure Function, consider reading my article here. Prerequisites You should have a valid Azure Subscription You should have a running Azure Function If you are not sure about how to [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>[toc]</p>



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



<p>I have tried many things with Azure Functions and you should be able to see then <a href="https://sibeeshpassion.com/tag/azure-function/">here</a>. Here in this post we are going to see how we can create a job which runs in a particular day and time to delete the blobs we have in a blob containers in our Azure Storage Account. If you want to know how you can upload to the blobs using Azure Function, consider reading my article <a href="https://sibeeshpassion.com/timertrigger-azure-function-to-upload-to-azure-blob-daily/">here</a>. </p>



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



<ul class="wp-block-list"><li>You should have a valid Azure Subscription </li><li>You should have a running Azure Function</li><li>If you are not sure about how to create an Azure Function App, <a href="https://sibeeshpassion.com/iothubtrigger-azure-function-and-azure-iot-hub/#creating-an-azure-function-app"><em>this post</em></a> may help you.</li><li>You should have a valid Azure Storage Account</li></ul>



<h2 class="wp-block-heading">Using the code</h2>



<h3 class="wp-block-heading">Configure the Dependency Injection in Azure Function</h3>



<p>As we are going to inject our dependency via constructor we need to configure the same by creating a Startup.cs class in our solution. Let&#8217;s do that first. To configure, make sure that you had installed the Nuget Package <strong><em>Microsoft.Azure.Functions.Extensions</em></strong>. </p>



<p>Now create a new class and name it as Startup.cs and write the code as preceding. </p>



<script src="https://gist.github.com/SibeeshVenu/e60c3c180bd2052938e848ddbe951652.js"></script>



<p>Here we are adding a singleton service for our IBlobService. Do not forget to inherit your <em>Startup </em>class from  <em>FunctionsStartup</em>.</p>



<h3 class="wp-block-heading">Write the Azure Function </h3>



<p>As we have set up our Startup class, now let us create our Azure Function. Follow <a href="https://sibeeshpassion.com/timertrigger-azure-function-to-upload-to-azure-blob-daily/#creating-an-azure-function-in-function-app"><strong>this post</strong></a> to see how you can create one. And you can write the code as preceding.</p>



<script src="https://gist.github.com/SibeeshVenu/9455c80616c051f13a989553eb8b9425.js"></script>



<p>Here we are making the Function to run on every Monday at 4 AM using the CRON expression. Make sure to check my previous post to see more about the CRON expression.</p>



<p>Below are the blob container names I have in my Azure Blob Storage.</p>



<script src="https://gist.github.com/SibeeshVenu/00ba5ed0b4ce1cf4464dcf8c06d996c1.js"></script>



<p>Make sure to use the small letters for your Azure Blob Container names, otherwise you will see an exception as mentioned <a href="https://stackoverflow.com/questions/45305556/azure-table-storage-names-invalid-characters/57180310#57180310">here</a>. </p>



<h3 class="wp-block-heading">Creating the Blob Service</h3>



<p>Now let us create a new Interface for our service.</p>



<script src="https://gist.github.com/SibeeshVenu/3e86c52da6ea5689610b16607f263f2c.js"></script>



<p>And then create a service <strong>BlobService</strong>.</p>



<script src="https://gist.github.com/SibeeshVenu/3e0baeaa3e02dd95721a716ef517119c.js"></script>



<p>Here you can see that in the <em>PerformTasks </em>function we are getting the blob container reference and then get all the blobs using <em>ListBlobsSegmentedAsync</em> and then cast it as <em>ICloudBlob</em> so that we can easily delete the blobs. </p>



<p>Make sure to add the <em>AzureWebJobsStorage</em> in your local.settings.json file and in the Azure Function Configuration in the portal.</p>



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



<p>Wow!. Now we have learned,</p>



<ul class="wp-block-list"><li>about Azure Function and setting up the same</li><li>about Time Trigger in Azure Function</li><li>about CRON expressions in Azure Function</li><li>how to set up dependency injection in Azure Function</li><li>how to delete Azure blobs from Azure Blob Containers using Azure Function</li></ul>



<p>You can always ready my Azure articles&nbsp;<a href="https://sibeeshpassion.com/category/azure/">here</a>.</p>



<h2 class="wp-block-heading">Your turn. What do you think?</h2>



<p>Thanks a lot for reading. Did I miss anything that you may think which is needed in this article? Could you find this post as useful? Kindly do not forget to share me your feedback.</p>



<p>Kindest Regards<br>Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sibeeshpassion.com/azure-function-job-to-delete-azure-blobs-from-blob-containers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Fix for 404 ResourceNotFound Error After Uploading to Azure Container</title>
		<link>https://www.sibeeshpassion.com/fix-for-404-resourcenotfound-error-after-uploading-to-azure-container/</link>
					<comments>https://www.sibeeshpassion.com/fix-for-404-resourcenotfound-error-after-uploading-to-azure-container/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sat, 27 May 2017 09:18:15 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Azure 404 Error]]></category>
		<category><![CDATA[Azure Container]]></category>
		<category><![CDATA[Azure ResourceNotFound]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=12406</guid>

					<description><![CDATA[[toc] Introduction Here, in this post we are going to a see how we can resolve the error 404 ResourceNotFound Error After Uploading to Azure CDN . It is obvious that you may feel very sad, if you are unable to see the image you recently uploaded to Azure container. But, you don&#8217;t need to worry about it, as the fix for this error is very simple and in this post I am going to show you that. I hope you will like this. Now let&#8217;s begin. Background I recently created a new container in my Azure storage account and [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>[toc]</p>
<h3>Introduction</h3>
<p>Here, in this post we are going to a see how we can resolve the error 404 <em>ResourceNotFound Error After Uploading to Azure CDN </em>. It is obvious that you may feel very sad, if you are unable to see the image you recently uploaded to <a href="http://sibeeshpassion.com/category/Azure" target="_blank">Azure </a>container. But, you don&#8217;t need to worry about it, as the fix for this error is very simple and in this post I am going to show you that. I hope you will like this. Now let&#8217;s begin.</p>
<h3>Background</h3>
<p>I recently created a new container in my Azure storage account and uploaded one image in it. And when I was just opening that image in my browser, I was just getting an error as preceding.</p>
<p>[xml]<br />
This XML file does not appear to have any style information associated with it. The document tree is shown below.<br />
<Error><br />
<Code>ResourceNotFound</Code><br />
<Message><br />
The specified resource does not exist. RequestId:36bdbcfb-0001-0022-44c6-d60b93000000 Time:2017-05-27T08:55:09.8382429Z<br />
</Message><br />
</Error><br />
[/xml]</p>
<p>I was able to download that image and the problem exists only when I open it in the browser. Then I came to know about the Access policy of Azure containers. Here we are going to see a bit introduction about that policy. </p>
<h3>Solution for Azure 404 Error</h3>
<p>Step 1: Login to your Azure Portal and navigate to your container.<br />
Step 2: Now, click on the three dots (&#8230;) and then Access Policy.<br />
Step 3: Select the access type you prefer.</p>
<p><div id="attachment_12408" style="width: 603px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2017/05/Option-to-see-Azure-Container-Policy.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-12408" src="http://sibeeshpassion.com/wp-content/uploads/2017/05/Option-to-see-Azure-Container-Policy.png" alt="Option to see Azure Container Policy" width="593" height="210" class="size-full wp-image-12408" srcset="/wp-content/uploads/2017/05/Option-to-see-Azure-Container-Policy.png 593w, /wp-content/uploads/2017/05/Option-to-see-Azure-Container-Policy-300x106.png 300w, /wp-content/uploads/2017/05/Option-to-see-Azure-Container-Policy-400x142.png 400w" sizes="(max-width: 593px) 100vw, 593px" /></a><p id="caption-attachment-12408" class="wp-caption-text">Option to see Azure Container Policy</p></div></p>
<p>According to Microsoft, Access Policy specifies whether data in the container may be accessed publicly. By default, container data is private to the account owner. Use &#8216;Blob&#8217; to allow public read access for blobs. Use &#8216;Container&#8217; to allow public read and list access to the entire container.</p>
<p>So here I am going to give the policy as Blob.</p>
<p><div id="attachment_12409" style="width: 553px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2017/05/Change-the-Azure-Access-Policy-to-Blob.png"><img decoding="async" aria-describedby="caption-attachment-12409" src="http://sibeeshpassion.com/wp-content/uploads/2017/05/Change-the-Azure-Access-Policy-to-Blob.png" alt="Change the Azure Access Policy to Blob" width="543" height="214" class="size-full wp-image-12409" srcset="/wp-content/uploads/2017/05/Change-the-Azure-Access-Policy-to-Blob.png 543w, /wp-content/uploads/2017/05/Change-the-Azure-Access-Policy-to-Blob-300x118.png 300w, /wp-content/uploads/2017/05/Change-the-Azure-Access-Policy-to-Blob-400x158.png 400w" sizes="(max-width: 543px) 100vw, 543px" /></a><p id="caption-attachment-12409" class="wp-caption-text">Change the Azure Access Policy to Blob</p></div></p>
<p>You can always do this with some C# code as well.</p>
<p>[csharp]<br />
public static void SetPublicContainerPermissions(CloudBlobContainer container)<br />
{<br />
    BlobContainerPermissions perm = container.GetPermissions();<br />
    perm.PublicAccess = BlobContainerPublicAccessType.Blob;<br />
    container.SetPermissions(perm);<br />
}<br />
[/csharp]</p>
<p>Here is the above example, we are accessing the permissions and assigning the Blob access type. You can always use &#8216;Container&#8217; if you want to limit the access to container. In any case, if you need to remove the permission to anonymous users, you can use <em>BlobContainerPublicAccessType.Off</em>. Once you are done, please reload the URL again the browser, I am sure you will be able to see your image. Happy Uploading!.</p>
<h3>Conclusion</h3>
<p>Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<h3>Your turn. What do you think?</h3>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sibeeshpassion.com/fix-for-404-resourcenotfound-error-after-uploading-to-azure-container/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
