<?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 HowTo - TheCodeBuzz</title>
	<atom:link href="https://thecodebuzz.com/category/azure-howto/feed/" rel="self" type="application/rss+xml" />
	<link>https://thecodebuzz.com</link>
	<description>Best Practices for Software Development</description>
	<lastBuildDate>Tue, 03 Oct 2023 21:00:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://thecodebuzz.com/wp-content/uploads/2022/11/cropped-android-chrome-512x512-1-1-51x51.jpg</url>
	<title>Azure HowTo - TheCodeBuzz</title>
	<link>https://thecodebuzz.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Copy Docker Container Images to Azure Private Registry</title>
		<link>https://thecodebuzz.com/copy-docker-container-image-to-azure-private-registry/</link>
					<comments>https://thecodebuzz.com/copy-docker-container-image-to-azure-private-registry/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 14 Aug 2022 17:41:00 +0000</pubDate>
				<category><![CDATA[Azure HowTo]]></category>
		<category><![CDATA[Container]]></category>
		<category><![CDATA[Copy Docker Container to Azure]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=21661</guid>

					<description><![CDATA[<p>Copy Docker Container Images to Azure Private Registry Today in this article, we will see how to Import or copy Docker Container Images to Azure Private Registry using step by step guide. Here you can use simple Azure CLI or Power CLI commands to copy or import ready images from a public registry like DockerHub. [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/copy-docker-container-image-to-azure-private-registry/">Copy Docker Container Images to Azure Private Registry</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading">Copy Docker Container Images to Azure Private Registry</h1>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="478" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/Copy-or-import-Docker-Container-Image-to-Azure-Private-Registry-1024x478.jpg" alt="" class="wp-image-21683" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-or-import-Docker-Container-Image-to-Azure-Private-Registry-1024x478.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-or-import-Docker-Container-Image-to-Azure-Private-Registry-300x140.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-or-import-Docker-Container-Image-to-Azure-Private-Registry-768x359.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-or-import-Docker-Container-Image-to-Azure-Private-Registry-1536x718.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-or-import-Docker-Container-Image-to-Azure-Private-Registry-2048x957.jpg 2048w, https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-or-import-Docker-Container-Image-to-Azure-Private-Registry-785x367.jpg 785w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Today in this article, we will see how to Import or copy Docker Container Images to Azure Private Registry using step by step guide.</p>



<p></p>



<p>Here you can use simple Azure CLI or Power CLI commands to copy or import ready images from a public registry like DockerHub.</p>



<p></p>



<p>We will see below how to import the Docker Images from DockerHub without using any docker commands.</p>



<p></p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-getting-started---import-from-docker-hub">Getting started &#8211; Import from Docker Hub</a></li><li><a href="#aioseo-step-1--create-azure-container-registry">Step 1- Create Azure  container registry</a></li><li><a href="#aioseo-step-2--import-image-from-docker-hub">Step 2- Import Image from Docker Hub</a></li><li><a href="#aioseo-verify-or-list-container-images-from-azure-registry">Verify or List container images from Azure Registry</a></li></ul></div>



<p></p>



<h2 class="wp-block-heading" id="aioseo-getting-started---import-from-docker-hub">Getting started &#8211; Import from Docker Hub</h2>



<p></p>



<p>Please login to the Azure Cloud subscription account and have a resource group ready so as to use this feature.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-step-1--create-azure-container-registry">Step 1- Create Azure  container registry </h2>



<p></p>



<p>If you already have ACR created you can skip this step.</p>



<p></p>



<p>Let&#8217;s use the below steps to create an Azure Container registry.</p>



<p></p>



<p><strong>Command </strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az acr create --resource-group myResourceGroup
--name myRegistry --sku Basic</pre>



<p></p>



<p><strong>Example </strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az acr create --resource-group thecodebuzz-group --name TheCodeBuzzRegistry --sku basic</pre>



<p></p>



<h2 class="wp-block-heading" id="aioseo-step-2--import-image-from-docker-hub">Step 2- Import Image from Docker Hub</h2>



<p></p>



<p>I have the below images in the remote Docker hub.</p>



<p></p>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/Copy-Docker-Container-Image-to-Private-Registry-azure-cli.jpg" alt="Copy Docker Container Image to Azure Private Registry " class="wp-image-21680" width="437" height="395" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-Docker-Container-Image-to-Private-Registry-azure-cli.jpg 719w, https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-Docker-Container-Image-to-Private-Registry-azure-cli-300x271.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-Docker-Container-Image-to-Private-Registry-azure-cli-575x520.jpg 575w" sizes="(max-width: 437px) 100vw, 437px" /></figure>



<p></p>



<p></p>



<p><strong>Command</strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az acr import  --name myRegistry 
--source docker.io/&lt;repo-name&gt;/&lt;image-name&gt;:&lt;tag-name&gt; --image &lt;image-name&gt;:&lt;tag-name&gt;


</pre>



<p>OR</p>



<p></p>



<p>If You need to use a Docker username and password for authentication,</p>



<p> </p>



<pre id="block-cbcb70c1-9609-4293-9b4b-4927e0de512a" class="wp-block-preformatted has-medium-font-size">az acr import  --name myRegistry <br>--source docker.io/&lt;repo-name&gt;/&lt;image-name&gt;:&lt;tag-name&gt; --image &lt;image-name&gt;:&lt;tag-name&gt; --username &lt;username&gt; --password &lt;password&gt;</pre>



<p></p>



<p id="block-cbcb70c1-9609-4293-9b4b-4927e0de512a"><strong>Example </strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az acr import --name TheCodeBuzzRegistry --source docker.io/firstthecodebuzz/forazureacr:v1 --image forazureacr:v1 --username firstthecodebuzz --password *****



 </pre>



<p>Once executed you shall be able to import the image into the Azure private registry. Please wait some time to get the import finished successfully.</p>



<p></p>



<p></p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="75" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/Import-Docker-Container-Image-to-Azure-Private-Registry-azure-cli-1024x75.jpg" alt="" class="wp-image-21681" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/Import-Docker-Container-Image-to-Azure-Private-Registry-azure-cli-1024x75.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/04/Import-Docker-Container-Image-to-Azure-Private-Registry-azure-cli-300x22.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/Import-Docker-Container-Image-to-Azure-Private-Registry-azure-cli-768x56.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/Import-Docker-Container-Image-to-Azure-Private-Registry-azure-cli-1536x112.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2022/04/Import-Docker-Container-Image-to-Azure-Private-Registry-azure-cli-2048x150.jpg 2048w, https://thecodebuzz.com/wp-content/uploads/2022/04/Import-Docker-Container-Image-to-Azure-Private-Registry-azure-cli-785x57.jpg 785w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-verify-or-list-container-images-from-azure-registry">Verify or List container images from Azure Registry</h2>



<p></p>



<p>Please use the below command to list and verify available images in the Azure registry,</p>



<p></p>



<p><strong>Command </strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az acr repository list --name myRegistryName --output table</pre>



<p></p>



<p><strong>Example </strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az acr repository list --name thecodebuzzregistry --output table</pre>



<p></p>



<p>OR</p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az acr repository list --name thecodebuzzregistry.azurecr.io --output table</pre>



<p></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="209" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/Copy-Docker-Container-Image-to-Azure-Private-Registry-using-azure-cli-1024x209.jpg" alt="Copy Docker Container Image to Azure Private Registry " class="wp-image-21682" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-Docker-Container-Image-to-Azure-Private-Registry-using-azure-cli-1024x209.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-Docker-Container-Image-to-Azure-Private-Registry-using-azure-cli-300x61.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-Docker-Container-Image-to-Azure-Private-Registry-using-azure-cli-768x156.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-Docker-Container-Image-to-Azure-Private-Registry-using-azure-cli-1536x313.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-Docker-Container-Image-to-Azure-Private-Registry-using-azure-cli-2048x417.jpg 2048w, https://thecodebuzz.com/wp-content/uploads/2022/04/Copy-Docker-Container-Image-to-Azure-Private-Registry-using-azure-cli-785x160.jpg 785w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<p>Finally, you shall see that your docker image was successfully imported from the docker hub to the Azure private registry.</p>



<p></p>



<p><strong><em>References</em></strong>:  </p>



<ul class="wp-block-list">
<li><a href="https://www.thecodebuzz.com/angular-app-dockerize-containerize-using-ngnix/" target="_blank" rel="noreferrer noopener"><em><strong>Docker- Containerize an Angular App with NGNIX</strong></em></a></li>
</ul>



<p></p>



<p style="font-size:18px">Do you have any <strong>comments or ideas or any better </strong>suggestions to share?</p>



<p class="has-small-font-size"></p>



<p style="font-size:18px">Please sound off your comments below.</p>



<p class="has-medium-font-size"></p>



<p class="has-medium-font-size"><strong>Happy Coding </strong>!!</p>



<p></p>



<p></p>



<hr>



<p class=""></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></p>



<p></p>



<p></p>



<p></p><p>The post <a href="https://thecodebuzz.com/copy-docker-container-image-to-azure-private-registry/">Copy Docker Container Images to Azure Private Registry</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/copy-docker-container-image-to-azure-private-registry/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Azure &#8211; Get All Pull requests using ADO DevOps API</title>
		<link>https://thecodebuzz.com/azure-ado-api-get-all-pull-requests-using-ado-devops-api/</link>
					<comments>https://thecodebuzz.com/azure-ado-api-get-all-pull-requests-using-ado-devops-api/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 04 Jul 2022 00:54:00 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Azure HowTo]]></category>
		<category><![CDATA[azure devops api approve pull request]]></category>
		<category><![CDATA[azure devops api examples]]></category>
		<category><![CDATA[azure devops api get file from repo]]></category>
		<category><![CDATA[azure devops api list git branches]]></category>
		<category><![CDATA[azure devops export pull requests]]></category>
		<category><![CDATA[azure devops organization api]]></category>
		<category><![CDATA[azure devops show all pull requests]]></category>
		<category><![CDATA[postman azure devops rest api]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=22783</guid>

					<description><![CDATA[<p>Azure &#8211; Get All Pull requests using ADO DevOps API Today in this article, we will see Azure &#8211; Get All Pull requests using ADO DevOps API feature in detail. It&#8217;s easy to call Azure DevOps API and get the pull request details. One can automate the process using the AZ command or CLI or [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/azure-ado-api-get-all-pull-requests-using-ado-devops-api/">Azure – Get All Pull requests using ADO DevOps API</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading">Azure &#8211; Get All Pull requests using ADO DevOps API</h1>



<figure class="wp-block-image size-full is-resized"><a href="https://www.thecodebuzz.com/trigger-azure-pipelines-build-api-for-automating-azure-devops" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/03/how-to-queue-a-new-build-using-vsts-rest-api.jpg" alt="API for automating Azure DevOps Pipelines ,trigger-azure-pipelines-build-api-for-automating-azure-devops" class="wp-image-21348" width="722" height="371" srcset="https://thecodebuzz.com/wp-content/uploads/2022/03/how-to-queue-a-new-build-using-vsts-rest-api.jpg 906w, https://thecodebuzz.com/wp-content/uploads/2022/03/how-to-queue-a-new-build-using-vsts-rest-api-300x155.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/03/how-to-queue-a-new-build-using-vsts-rest-api-768x396.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/03/how-to-queue-a-new-build-using-vsts-rest-api-785x405.jpg 785w" sizes="auto, (max-width: 722px) 100vw, 722px" /></a></figure>



<p>Today in this article, we will see Azure &#8211; Get All Pull requests using ADO DevOps API feature in detail.</p>



<p></p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-trigger-an-ado-build--using-queue-api">Trigger an ADO build- using Queue API</a></li><li><a href="#aioseo-configuration-and-security">Configuration and security</a></li></ul></div>



<p>It&#8217;s easy to call Azure DevOps API and get the pull request details. One can automate the process using the AZ command or CLI or PowerShell script.</p>



<p></p>



<p></p>



<p>We will use the below API for the same.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-trigger-an-ado-build--using-queue-api">Trigger an ADO build- using Queue API </h2>



<p></p>



<p><strong>GET API</strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repo-name}/pullrequests?&amp;api-version=6.0</pre>



<p></p>



<p><strong>Build pipeline With optional parameters</strong></p>



<p></p>



<p><strong>GET API</strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">https://dev.azure.com/jan2022-thecodebuzz/globalexceptionhandler/_apis/git/repositories/globalexceptionhandler/pullrequests?&amp;api-version=6.0</pre>



<p></p>



<p></p>



<p></p>



<p>In the above Post request below are the input parameters,</p>



<p></p>



<ul class="wp-block-list"><li><strong><em>organization </em> </strong>&#8211; The name of the Azure DevOps organization.</li></ul>



<ul class="wp-block-list"><li><em><strong>project</strong>  </em>&#8211; Project ID or project name</li></ul>



<ul class="wp-block-list"><li><strong><em>api version </em></strong>&#8211; Version of the API to use. </li></ul>



<p></p>



<p></p>



<p>Below is our sample repository,</p>



<p></p>



<p class="has-medium-font-size"><a href="https://dev.azure.com/jan2022-thecodebuzz/globalexceptionhandler/_build">https://dev.azure.com/jan2022-thecodebuzz/globalexceptionhandler/_build</a></p>



<p></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="622" src="https://www.thecodebuzz.com/wp-content/uploads/2022/03/trigger-azure-pipelines-build-via-api-1024x622.jpg" alt="Azure - Get All Pull requests using ADO DevOps API " class="wp-image-21341" srcset="https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-azure-pipelines-build-via-api-1024x622.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-azure-pipelines-build-via-api-300x182.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-azure-pipelines-build-via-api-768x466.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-azure-pipelines-build-via-api-1536x933.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-azure-pipelines-build-via-api-785x477.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-azure-pipelines-build-via-api.jpg 1976w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<h2 class="wp-block-heading" id="aioseo-configuration-and-security">Configuration and security </h2>



<p></p>



<p>Let&#8217;s now configure the API to be invoked securely.</p>



<p></p>



<p>Step1- Click on the User settings and set up the <em><strong>personal access token</strong></em>.</p>



<p></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/03/UntitAPI-for-automating-Azure-DevOps-Pipelinesled-730x1024.jpg" alt="start-a-build-and-passing-variables-through-azure-devops-rest-api" class="wp-image-21342" width="313" height="439" srcset="https://thecodebuzz.com/wp-content/uploads/2022/03/UntitAPI-for-automating-Azure-DevOps-Pipelinesled-730x1024.jpg 730w, https://thecodebuzz.com/wp-content/uploads/2022/03/UntitAPI-for-automating-Azure-DevOps-Pipelinesled-214x300.jpg 214w, https://thecodebuzz.com/wp-content/uploads/2022/03/UntitAPI-for-automating-Azure-DevOps-Pipelinesled-371x520.jpg 371w, https://thecodebuzz.com/wp-content/uploads/2022/03/UntitAPI-for-automating-Azure-DevOps-Pipelinesled.jpg 765w" sizes="auto, (max-width: 313px) 100vw, 313px" /></figure>



<p>Define a name for this token and authorize the scope of access with this token. You can choose this token access for the Build pipeline trigger or release pipeline trigger etc.</p>



<p></p>



<p>I have below sample 2 pull request </p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="289" src="https://www.thecodebuzz.com/wp-content/uploads/2022/07/Azure-Get-All-Pull-requests-using-ADO-DevOps-API--1024x289.jpg" alt="" class="wp-image-22784" srcset="https://thecodebuzz.com/wp-content/uploads/2022/07/Azure-Get-All-Pull-requests-using-ADO-DevOps-API--1024x289.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/07/Azure-Get-All-Pull-requests-using-ADO-DevOps-API--300x85.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/07/Azure-Get-All-Pull-requests-using-ADO-DevOps-API--768x216.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/07/Azure-Get-All-Pull-requests-using-ADO-DevOps-API--785x221.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2022/07/Azure-Get-All-Pull-requests-using-ADO-DevOps-API-.jpg 1462w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<p></p>



<p>Once you execute the GET API, all metadata associated with Pull request can be accessed easily ,</p>



<p></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="681" src="https://www.thecodebuzz.com/wp-content/uploads/2022/07/Azure-Get-All-Pull-requests-using-ADO-DevOps-powershell-1024x681.jpg" alt="" class="wp-image-22785" srcset="https://thecodebuzz.com/wp-content/uploads/2022/07/Azure-Get-All-Pull-requests-using-ADO-DevOps-powershell-1024x681.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/07/Azure-Get-All-Pull-requests-using-ADO-DevOps-powershell-300x200.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/07/Azure-Get-All-Pull-requests-using-ADO-DevOps-powershell-768x511.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/07/Azure-Get-All-Pull-requests-using-ADO-DevOps-powershell-782x520.jpg 782w, https://thecodebuzz.com/wp-content/uploads/2022/07/Azure-Get-All-Pull-requests-using-ADO-DevOps-powershell.jpg 1200w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<p><strong>References</strong>: </p>



<p></p>



<ul class="has-medium-font-size wp-block-list"><li><a href="https://www.thecodebuzz.com/create-https-nginx-on-linux-azure-virtual-machine-ubuntu/" target="_blank" rel="noreferrer noopener" title="Create HTTP with NGINX on Linux in Azure Virtual Machine"><em>Create HTTP with NGINX on Linux in Azure Virtual Machine</em></a></li></ul>



<p></p>



<ul class="has-medium-font-size wp-block-list"><li><a style="font-size: revert;" href="https://www.thecodebuzz.com/azure-devops-build-pipelines-using-run-pipeline-api-automate/" title="Automating Azure DevOps Build Pipelines using Run Pipeline API"><em>Automating Azure DevOps Build Pipelines using Run Pipeline API</em></a> </li></ul>



<hr>



<p class=""></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></p><p>The post <a href="https://thecodebuzz.com/azure-ado-api-get-all-pull-requests-using-ado-devops-api/">Azure – Get All Pull requests using ADO DevOps API</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/azure-ado-api-get-all-pull-requests-using-ado-devops-api/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Azure KeyVault &#8211; Create, Purge or Soft Delete or Recover secretes</title>
		<link>https://thecodebuzz.com/azure-keyvault-create-purge-or-soft-delete-or-recover-secretes/</link>
					<comments>https://thecodebuzz.com/azure-keyvault-create-purge-or-soft-delete-or-recover-secretes/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 13 Jun 2022 17:44:00 +0000</pubDate>
				<category><![CDATA[Azure HowTo]]></category>
		<category><![CDATA[allow the azure app configuration instance to use an azure key vault key]]></category>
		<category><![CDATA[az keyvault list-deleted]]></category>
		<category><![CDATA[az keyvault purge]]></category>
		<category><![CDATA[azure key vault permissions list]]></category>
		<category><![CDATA[azure key vault soft-delete vs purge protection]]></category>
		<category><![CDATA[disable purge protection key vault]]></category>
		<category><![CDATA[purge protection azure key vault]]></category>
		<category><![CDATA[the operation "purge" is not enabled in the access policy of this secret]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=21809</guid>

					<description><![CDATA[<p>AzuAzure KeyVault &#8211; Create, Purge or Soft Delete or Recover secretes Today in this article, we will go over a few basic commands for Azure KeyVault &#8211; Create, Purge or Soft Delete or Recover secretes. Using Portal to delete the Vault Secretes f you need to delete an app secrete, then you can delete the [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/azure-keyvault-create-purge-or-soft-delete-or-recover-secretes/">Azure KeyVault – Create, Purge or Soft Delete or Recover secretes</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading">AzuAzure KeyVault &#8211; Create, Purge or Soft Delete or Recover secretes</h1>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="506" height="397" src="https://www.thecodebuzz.com/wp-content/uploads/2022/07/secure-api-secrets-azure-key-vault-.jpg" alt="" class="wp-image-22789" srcset="https://thecodebuzz.com/wp-content/uploads/2022/07/secure-api-secrets-azure-key-vault-.jpg 506w, https://thecodebuzz.com/wp-content/uploads/2022/07/secure-api-secrets-azure-key-vault--300x235.jpg 300w" sizes="auto, (max-width: 506px) 100vw, 506px" /></figure>



<p>Today in this article, we will go over a few basic commands for Azure KeyVault &#8211; Create, Purge or Soft Delete or Recover secretes.</p>



<p></p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-using-portal-to-delete-the-vault-secretes">Using Portal to delete the Vault Secretes</a></li><li><a href="#aioseo-recover-deleted-secretes">Recover deleted secretes</a></li><li><a href="#aioseo-get-the-list-of-deleted-secretes">Get the list of deleted secretes</a></li></ul></div>



<p></p>



<h2 class="wp-block-heading" id="aioseo-using-portal-to-delete-the-vault-secretes">Using Portal to delete the Vault Secretes</h2>



<p></p>



<p> f you need to delete an app secrete, then you can delete the secretes using the below option,</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Delete-vault-secretes-using-Azure-Portal-1024x408.jpg" alt="Azure KeyVault - Create, Purge or Soft Delete or Recover secretes" class="wp-image-21817" width="603" height="239" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Delete-vault-secretes-using-Azure-Portal-1024x408.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Delete-vault-secretes-using-Azure-Portal-300x119.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Delete-vault-secretes-using-Azure-Portal-768x306.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Delete-vault-secretes-using-Azure-Portal-785x313.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Delete-vault-secretes-using-Azure-Portal.jpg 1273w" sizes="auto, (max-width: 603px) 100vw, 603px" /></figure>



<p>If you need to delete an app secrete then use the below command,</p>



<p></p>



<p><strong>Command </strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az keyvault secret purge --name appsecret --vault-name newvault1000</pre>



<p></p>



<p>Example </p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az keyvault secret purge --name appsecret --vault-name newvault1000</pre>



<p></p>



<p>If the deletes are enabled as soft delete , means all the secretes deleted will go into a retention period and will be retained up to <strong><em>90 days after the cut-off tim</em></strong>e.</p>



<p></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="315" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Purge-or-Soft-Delete-secretes-retention-is-enabled-1024x315.jpg" alt="" class="wp-image-21815" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Purge-or-Soft-Delete-secretes-retention-is-enabled-1024x315.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Purge-or-Soft-Delete-secretes-retention-is-enabled-300x92.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Purge-or-Soft-Delete-secretes-retention-is-enabled-768x236.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Purge-or-Soft-Delete-secretes-retention-is-enabled-1536x472.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Purge-or-Soft-Delete-secretes-retention-is-enabled-2048x630.jpg 2048w, https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Purge-or-Soft-Delete-secretes-retention-is-enabled-785x241.jpg 785w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<h2 class="wp-block-heading" id="aioseo-recover-deleted-secretes">Recover deleted secretes</h2>



<p></p>



<p><strong>Command </strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az keyvault secret recover --name appsecret --vault-name newvault1000</pre>



<p></p>



<p><strong>Example </strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az keyvault secret recover --name appsecret --vault-name newvault1000</pre>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-get-the-list-of-deleted-secretes">Get the list of deleted secretes</h2>



<p></p>



<p><strong>Command</strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az keyvault secret list-deleted --vault-name newvault1000</pre>



<p></p>



<p><strong>Example </strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az keyvault secret list-deleted --vault-name thecodebuzz-key-vault
</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="509" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Purge-or-Soft-Delete-secretes-1-1024x509.jpg" alt="" class="wp-image-21813" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Purge-or-Soft-Delete-secretes-1-1024x509.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Purge-or-Soft-Delete-secretes-1-300x149.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Purge-or-Soft-Delete-secretes-1-768x382.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Purge-or-Soft-Delete-secretes-1-1536x763.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Purge-or-Soft-Delete-secretes-1-785x390.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2022/04/Azure-Key-Vault-Purge-or-Soft-Delete-secretes-1.jpg 1614w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<p><strong><em>References</em></strong> : </p>



<p></p>



<ul class="has-medium-font-size wp-block-list"><li><a href="https://www.thecodebuzz.com/secure-secrets-azure-key-vault-examples-csharp-java-python-nodejs/" target="_blank" rel="noreferrer noopener" title="Secure secrets using Azure KeyVault MSI with examples"><em>Secure secrets using Azure KeyVault MSI with examples</em></a></li></ul>



<p></p>



<p style="font-size:18px">Do you have any <strong>comments or ideas or any better </strong>suggestions to share?</p>



<p class="has-small-font-size"></p>



<p style="font-size:18px">Please sound off your comments below.</p>



<p class="has-medium-font-size"></p>



<p class="has-medium-font-size"><strong>Happy Coding </strong>!!</p>



<p></p>



<p></p><p>The post <a href="https://thecodebuzz.com/azure-keyvault-create-purge-or-soft-delete-or-recover-secretes/">Azure KeyVault – Create, Purge or Soft Delete or Recover secretes</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/azure-keyvault-create-purge-or-soft-delete-or-recover-secretes/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Secure secrets using Azure KeyVault -Approach II</title>
		<link>https://thecodebuzz.com/secure-secrets-using-azure-keyvault-approach-azure-client-secret/</link>
					<comments>https://thecodebuzz.com/secure-secrets-using-azure-keyvault-approach-azure-client-secret/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 11 May 2022 00:00:26 +0000</pubDate>
				<category><![CDATA[Azure HowTo]]></category>
		<category><![CDATA[azure key vault best practices]]></category>
		<category><![CDATA[azure key vault get all secrets]]></category>
		<category><![CDATA[azure key vault is used to store secrets for]]></category>
		<category><![CDATA[azure key vault python]]></category>
		<category><![CDATA[azure key vault secret]]></category>
		<category><![CDATA[azure key vault secret content type]]></category>
		<category><![CDATA[azure key vault secret name restrictions]]></category>
		<category><![CDATA[configure access to secrets in azure key vault with]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=21853</guid>

					<description><![CDATA[<p>Secure secrets using Azure KeyVault -Approach II Today in this article we will see how to secure secrets using Azure KeyVault using a non-MSI approach. Today in this article, we will cover below aspects, Here we will use configuration values for the below variables declaratively, AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET. Let&#8217;s look into step by step how [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/secure-secrets-using-azure-keyvault-approach-azure-client-secret/">Secure secrets using Azure KeyVault -Approach II</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading"><strong>Secure secrets using Azure KeyVault -Approach II</strong></h1>



<figure class="wp-block-image size-full"><a href="https://www.thecodebuzz.com/secure-secrets-using-azure-keyvault-approach-azure-client-secret" target="_blank" rel="noopener"><img loading="lazy" decoding="async" width="600" height="315" src="https://www.thecodebuzz.com/wp-content/uploads/2022/05/secure-api-secrets-azure-key-vault.jpg" alt="Secure secrets using Azure KeyVault" class="wp-image-22215" srcset="https://thecodebuzz.com/wp-content/uploads/2022/05/secure-api-secrets-azure-key-vault.jpg 600w, https://thecodebuzz.com/wp-content/uploads/2022/05/secure-api-secrets-azure-key-vault-300x158.jpg 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></a></figure>



<p>Today in this article we will see how to secure secrets using Azure KeyVault using a non-MSI approach.</p>



<p> Today in this article, we will cover below aspects,</p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-prerequisites">Prerequisites</a></li><li><a href="#aioseo-get-value-for-azure_client_id--azure_tenant_id--azure_client_secret">Get Value for AZURE_CLIENT_ID ,  AZURE_TENANT_ID , AZURE_CLIENT_SECRET</a></li><li><a href="#aioseo-approach-2---authenticate-the-application-using-msi--managed-service-identity">Approach 2 &#8211; Authenticate the Application using MSI ( Managed Service Identity</a></li></ul></div>



<p>Here we will use configuration values for the below variables declaratively, </p>



<ul class="wp-block-list"><li><em><strong>AZURE_CLIENT_ID</strong>, </em></li><li><em><strong>AZURE_TENANT_ID</strong>,</em></li><li><strong><em>AZURE_CLIENT_SECRET</em></strong>.</li></ul>



<p></p>



<p>Let&#8217;s look into step by step how to get the above-used <b><i>key vault URL</i></b> and define secretes value for <em><strong>DbPassword</strong></em>.</p>



<p></p>



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



<p></p>



<p>Before we get started with actual Azure Vault implementation please make sure you have the below prerequisites defined already in your Azure cloud account,</p>



<p></p>



<ul class="has-normal-font-size wp-block-list"><li>Create a Resource group( if not already exist )</li><li>Create an App Service plan</li><li>Create Azure WebApp (App Service) in the App service plan</li></ul>



<p></p>



<p>For more details on the above steps, please visit this article &#8211; <a href="https://www.thecodebuzz.com/secure-secrets-azure-key-vault-examples-csharp-java-python-nodejs/" target="_blank" rel="noreferrer noopener" title="Secure secrets using Azure KeyVault MSI with examples"><strong>Secure secrets using Azure KeyVault MSI with examples</strong></a></p>



<p></p>



<p>Please make sure to define variables <strong>AZURE_CLIENT_ID</strong>, <strong>AZURE_TENANT_ID</strong>, and <strong>AZURE_CLIENT_SECRET </strong>as <em><strong>Environment variables </strong></em>or as <em><strong>Application settings </strong></em>are defined with values. </p>



<p></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-define-access-policy-using-AD-1024x551.jpg" alt="" class="wp-image-21733" width="676" height="363" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-define-access-policy-using-AD-1024x551.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-define-access-policy-using-AD-300x161.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-define-access-policy-using-AD-768x413.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-define-access-policy-using-AD-785x422.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-define-access-policy-using-AD.jpg 1097w" sizes="auto, (max-width: 676px) 100vw, 676px" /></figure>



<p></p>



<h2 class="wp-block-heading" id="aioseo-get-value-for-azure_client_id--azure_tenant_id--azure_client_secret">Get Value for AZURE_CLIENT_ID ,  AZURE_TENANT_ID , AZURE_CLIENT_SECRET</h2>



<p></p>



<p>Let&#8217;s now see how to get value for  &#8220;AZURE_CLIENT_ID&#8221;, &#8220;AZURE_CLIENT_SECRET&#8221;, &#8220;AZURE_TENANT_ID&#8221; .</p>



<p></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>All these IDs (AZURE_CLIENT_ID,  AZURE_TENANT_ID, AZURE_CLIENT_SECRET ) are needed to authenticate/Identify the Application with Azure cloud. </p></blockquote>



<p></p>



<p></p>



<p>To get the defined values please go to the Azure default directory and click on the Application object</p>



<p></p>



<p><em><strong>Home -&gt; Default Directory&nbsp;&#8211; &gt;  App registrations</strong></em></p>



<p></p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="827" height="343" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-define-access-policy-using-application-object.jpg" alt="Azure KeyVault java example" class="wp-image-21736" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-define-access-policy-using-application-object.jpg 827w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-define-access-policy-using-application-object-300x124.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-define-access-policy-using-application-object-768x319.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-define-access-policy-using-application-object-785x326.jpg 785w" sizes="auto, (max-width: 827px) 100vw, 827px" /></figure>



<p>So above,</p>



<p></p>



<ul class="wp-block-list"><li>&#8220;<strong><em>AZURE_CLIENT_ID&#8221;</em></strong>  is equal to Application(client) ID as defined in the above screenshot.</li></ul>



<p></p>



<ul class="wp-block-list"><li> &#8220;<strong>AZURE_TENANT_ID</strong>&#8221;  is equal to Directory(tenant) ID as defined in the above screenshot.</li></ul>



<p></p>



<p>So so far we got the value  &#8220;AZURE_CLIENT_ID&#8221; and &#8220;AZURE_TENANT_ID&#8221;  using the above-highlighted credentials.</p>



<p></p>



<p>Next &#8220;<strong>AZURE_CLIENT_SECRET</strong>&#8221; can be generated for the application object using the below steps.</p>



<p></p>



<p>Please go to Azure Directory- &gt; App registration -&gt; Click on your Application</p>



<p></p>



<p>Next click on the <em><strong>Certificates and Secretes -&gt; Click on New Client Secretes</strong></em></p>



<p></p>



<figure class="wp-block-image"><img decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/image-3-1024x958.png" alt="Azure KeyVault node js example"/></figure>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
private IActionResult GetClientScrets()
        {
            SecretClientOptions options = new SecretClientOptions()
            {
                Retry =
                {
                    Delay= TimeSpan.FromSeconds(2),
                    MaxDelay = TimeSpan.FromSeconds(16),
                    MaxRetries = 5,
                    Mode = RetryMode.Exponential
                }
            };

            string keyVaultUrl = _configuration&#x5B;&quot;VaultURI&quot;];
            var client = new SecretClient(vaultUri: new Uri(keyVaultUrl), credential: new DefaultAzureCredential(),options);
            KeyVaultSecret secret = client.GetSecret(&quot;YourSecreteCode&quot;);
            return Ok(&quot;Your Secrete is &quot; + secret.Value);
        }
</pre></div>


<p></p>



<p>Let&#8217;s now execute the WebApp URL and verify the Vault secrets.</p>



<p></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="267" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/image-2-1024x267.png" alt="" class="wp-image-21776" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/image-2-1024x267.png 1024w, https://thecodebuzz.com/wp-content/uploads/2022/04/image-2-300x78.png 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/image-2-768x201.png 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/image-2-1536x401.png 1536w, https://thecodebuzz.com/wp-content/uploads/2022/04/image-2-785x205.png 785w, https://thecodebuzz.com/wp-content/uploads/2022/04/image-2.png 1731w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading" id="aioseo-approach-2---authenticate-the-application-using-msi--managed-service-identity"><strong>Approach 2 &#8211; Authenticate the Application using MSI ( Managed Service Identity </strong></h2>



<p></p>



<p>We can bootstrap the authentication code within the ASP.NET API pipeline using managed service identity feature of the Azure cloud.</p>



<p></p>



<p>Managed Service Identity (MSI) is a technique to automatically manage the identity in Azure Active Directory(Azure AD).  Key Vault service can be leveraged without having any token or credentials in your code which is generally needed as the first-time validation/authentication.</p>



<p></p>



<p>For more details please visit this article-<strong><em> <a href="https://www.thecodebuzz.com/secure-secrets-azure-key-vault-examples-csharp-java-python-nodejs/" target="_blank" rel="noreferrer noopener" title="Secure secrets using Azure KeyVault MSI with examples">Secure secrets using Azure KeyVault MSI with examples</a></em></strong></p>



<p></p>



<p><strong><em>Other references :</em></strong></p>



<p></p>



<ul class="has-medium-font-size wp-block-list"><li><a href="https://www.thecodebuzz.com/set-configuration-azure-using-app-service-azure-cli/" target="_blank" rel="noreferrer noopener" title="Set Configuration in Azure using App Service">Set Configuration in Azure using App Service</a></li></ul>



<ul class="has-medium-font-size wp-block-list"><li><a href="https://www.thecodebuzz.com/configuration-in-net-core-2-1/" target="_blank" rel="noreferrer noopener" title="Configuration in ASP.NET Core">Managing Configuration in ASP.NET Core</a></li></ul>



<p></p>



<hr>



<p class=""></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></p>



<p></p><p>The post <a href="https://thecodebuzz.com/secure-secrets-using-azure-keyvault-approach-azure-client-secret/">Secure secrets using Azure KeyVault -Approach II</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/secure-secrets-using-azure-keyvault-approach-azure-client-secret/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Secure secrets using Azure KeyVault MSI with examples</title>
		<link>https://thecodebuzz.com/secure-secrets-azure-key-vault-examples-csharp-java-python-nodejs/</link>
					<comments>https://thecodebuzz.com/secure-secrets-azure-key-vault-examples-csharp-java-python-nodejs/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 01 Apr 2022 03:54:00 +0000</pubDate>
				<category><![CDATA[Azure HowTo]]></category>
		<category><![CDATA[azure key vault best practices]]></category>
		<category><![CDATA[azure key vault documentation]]></category>
		<category><![CDATA[azure key vault implementation in c# .net core]]></category>
		<category><![CDATA[azure key vault is used to store secrets for]]></category>
		<category><![CDATA[azure key vault local development c#]]></category>
		<category><![CDATA[azure key vault MSI example]]></category>
		<category><![CDATA[azure key vault python]]></category>
		<category><![CDATA[azure.security.keyvault.secrets example c#]]></category>
		<category><![CDATA[Secure secrets using Azure KeyVault with examples]]></category>
		<category><![CDATA[vault using managed secured identity]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=21694</guid>

					<description><![CDATA[<p>Secure secrets using Azure KeyVault with examples Today in this article, we will see how to Secure secrets using Azure KeyVault with examples. We will see step-by-step detailed examples of how to secure and use secretes using the KeyVault service. Today in this article, we will cover below aspects, We will see how to use [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/secure-secrets-azure-key-vault-examples-csharp-java-python-nodejs/">Secure secrets using Azure KeyVault MSI with examples</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading">Secure secrets using Azure KeyVault with examples</h1>



<figure class="wp-block-image size-full is-resized"><a href="https://www.thecodebuzz.com/secure-secrets-azure-key-vault-examples-csharp-java-python-nodejs/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-1-1.jpg" alt="Secure secrets using Azure KeyVault MSI in C#.NET" class="wp-image-21786" width="579" height="454" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-1-1.jpg 506w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-1-1-300x235.jpg 300w" sizes="auto, (max-width: 579px) 100vw, 579px" /></a></figure>



<p>Today in this article, we will see how to Secure secrets using Azure KeyVault with examples. We will see step-by-step detailed examples of how to secure and use secretes using the KeyVault service. </p>



<p>Today in this article, we will cover below aspects,</p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-secure-secrets-using-azure-keyvault---getting-started">Secure secrets using Azure KeyVault &#8211; Getting Started</a></li><li><a href="#aioseo-prerequisites">Prerequisites</a></li><li><a href="#aioseo-azure-key-vault-service-setup">Azure Key Vault Service Setup</a></li><li><a href="#aioseo-create-azure-key-vault-service-using-azure-portal">Create Azure Key Vault service using Azure Portal</a></li><li><a href="#aioseo-define-configuration-of-keyvault">Define configuration of KeyVault</a></li><li><a href="#aioseo-add-access-policy-using-managed-identity-for-azure-keyvault">Add Access policy using Managed Identity for Azure KeyVault</a></li><li><a href="#aioseo-add-secretes-to-keyvault">Add Secretes to KeyVault</a></li><li><a href="#aioseo-using-azure-cli-for-adding-managed-identity-for-the-keyvault-service">Using Azure CLI for adding Managed Identity for the KeyVault service</a></li><li><a href="#aioseo-create-asp-net-core-api-or-mvc-application-using-net-6-or-net-5">Create ASP.NET Core API or MVC application using .NET 6 or .NET 5</a></li></ul></div>



<p>We will see how to use<strong><em> Managed identity for accessing Azure Key vault resources </em></strong>and will also cover how to access Azure key vault resources without using the Managed identity.</p>



<p>We will use<strong> Azure portal</strong> and <strong>Azure CLI</strong> commands both ways to achieve the same.</p>



<p></p>



<p>In this tutorial, we will deploy the web application to&nbsp;<a href="https://docs.microsoft.com/en-us/azure/app-service/overview" target="_blank" rel="noreferrer noopener"><em>Azure App Service.</em></a> We will use the Azure Key Vault secret client library for .NET&nbsp;and the&nbsp;Azure CLI.&nbsp;</p>



<p></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Managed identity let you authenticate to any service inlcuding Key Vault that supports Azure AD authentication. </p><p>Also You need not have to store keys or secretes in the code.</p></blockquote>



<p></p>



<p>You&#8217;ll use a managed identity to authenticate your Azure web app with an Azure key vault using</p>



<p></p>



<p>Azure KeyVault service is language agnostics (like any other Azure services offered) and can be used for <em><strong> .NET, JAVA, Node JS, and Pytho</strong>n </em>application as required.</p>



<p></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Below discussed high-level steps can be followed in any language of your choice.</p></blockquote>



<p></p>



<p>We will use a simple .NET API which will connect to Azure Vault to get the secured credentials like Connection string etc.</p>



<p></p>



<p>KeyVault lets you securely access secretes and sensitive information from within your applications. These Keys, secrets, and certificates are protected without you having to write the code yourself, and you can easily use them from your applications.</p>



<p></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Authentication in Key Vault works using Azure Active Directory (Azure AD) where, Azure AD authenticates the identity of any given&nbsp;<strong>security principal</strong>.</p></blockquote>



<p></p>



<p></p>



<p>Before we get started we will perform the basic configuration required for the Azure Key Vault service to function properly.</p>



<p></p>



<p>We will use a simple application that we will be hosting in Azure Cloud. This application will use the Vault to get the sensitive credentials.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-secure-secrets-using-azure-keyvault---getting-started">Secure secrets using Azure KeyVault &#8211; Getting Started</h2>



<p></p>



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



<p></p>



<p>Before we get started with actual Azure Vault implementation please make sure you have the below prerequisites defined already in your Azure cloud account,</p>



<p></p>



<ul class="has-medium-font-size wp-block-list"><li>Create a Resource group( if not already exist )</li><li>Create an App Service plan</li><li>Create Azure WebApp (App Service) in the App service plan</li></ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-azure-key-vault-service-setup"><strong>Azure Key Vault Service Setup</strong></h2>



<p></p>



<p>We can set up the Azure Key Vault service using multiple approaches.</p>



<p>We will mainly see two approaches i.e using Azure CLI and Azure Portal in this article</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-create-azure-key-vault-service-using-azure-portal"><strong>Create Azure Key Vault service using Azure Portal</strong></h2>



<p></p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="622" height="311" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service.jpg" alt="Azure KeyVault with examples" class="wp-image-21729" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service.jpg 622w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-300x150.jpg 300w" sizes="auto, (max-width: 622px) 100vw, 622px" /></figure>



<p></p>



<h2 class="wp-block-heading" id="aioseo-define-configuration-of-keyvault">Define configuration of KeyVault </h2>



<p></p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-create-keyvault-account.jpg" alt="" class="wp-image-21730" width="613" height="705" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-create-keyvault-account.jpg 774w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-create-keyvault-account-261x300.jpg 261w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-create-keyvault-account-768x883.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-create-keyvault-account-452x520.jpg 452w" sizes="auto, (max-width: 613px) 100vw, 613px" /></figure>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-add-access-policy-using-managed-identity-for-azure-keyvault">Add Access policy using Managed Identity for Azure KeyVault</h2>



<p></p>



<p>Please define the access policy as required for the vault service.</p>



<p></p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-define-access-policy-using-AD.jpg" alt=" Azure KeyVault C# example" class="wp-image-21731" width="610" height="438" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-define-access-policy-using-AD.jpg 815w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-define-access-policy-using-AD-300x215.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-define-access-policy-using-AD-768x551.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-define-access-policy-using-AD-724x520.jpg 724w" sizes="auto, (max-width: 610px) 100vw, 610px" /></figure>



<p></p>



<p></p>



<ul class="wp-block-list"><li>Above I have defined only &#8220;Get&#8221; access to key vault service.</li></ul>



<p> </p>



<ul class="wp-block-list"><li>For the<strong> “Select Principal”</strong> option, select the Azure Web App that you enabled Identity Management previously.</li></ul>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/image-1-1024x548.png" alt="" class="wp-image-21775" width="368" height="196" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/image-1-1024x548.png 1024w, https://thecodebuzz.com/wp-content/uploads/2022/04/image-1-300x160.png 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/image-1-768x411.png 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/image-1-785x420.png 785w, https://thecodebuzz.com/wp-content/uploads/2022/04/image-1.png 1045w" sizes="auto, (max-width: 368px) 100vw, 368px" /></figure>



<p>Once done your Vault account will be created successfully </p>



<p></p>



<p>Below highlighted URL is your <strong><em>AzureKy Vault </em></strong>URL.</p>



<p></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="234" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-define-access-policy-using-AD-and-create-keyvault-account-1024x234.jpg" alt="" class="wp-image-21732" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-define-access-policy-using-AD-and-create-keyvault-account-1024x234.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-define-access-policy-using-AD-and-create-keyvault-account-300x68.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-define-access-policy-using-AD-and-create-keyvault-account-768x175.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-define-access-policy-using-AD-and-create-keyvault-account-785x179.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-azure-key-vault-service-define-access-policy-using-AD-and-create-keyvault-account.jpg 1507w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<p>Please make a note of Vault URI &#8220;<em>https://thecodebuzz-key-vault.vault.azure.net/</em>&#8221; this is going to be used on the C# logic to connect to Vault and fetch the secretes. We will see more on the same in the below section.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-add-secretes-to-keyvault">Add Secretes to KeyVault</h2>



<p></p>



<p>Let&#8217;s now go to our Key Vault and add application secrete,</p>



<p></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/image-3-1024x958.png" alt="Azure KeyVault node js example" class="wp-image-21777" width="637" height="595"/></figure>



<p></p>



<p>Above I have added new secretes called &#8220;<strong><em>YourSecreteCode</em></strong>&#8221; with a value of &#8220;<em><strong>you are beautiful</strong></em>&#8220;</p>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-using-azure-cli-for-adding-managed-identity-for-the-keyvault-service"><strong>Using Azure CLI for adding Managed Identity for the KeyVault service </strong></h2>



<p></p>



<p><strong><em>Alternatively, </em></strong>If interested we can perform the above steps using CLI as well. </p>



<p></p>



<p>One can use the AZ CLI command to create an Azure Key Vault service account as below,</p>



<p></p>



<p>The below command can be used to create an Azure Key Vault account.</p>



<p></p>



<p><strong>Command</strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az keyvault create --resource-group "thecodebuzz-group" --name "thecodebuzz-vault"
</pre>



<p></p>



<p></p>



<p><strong><span style="font-size: revert; color: initial;">assign-identity command to create the identity for this application</span> </strong></p>



<p></p>



<p><strong>Command</strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az webapp identity assign --name "&lt;App-Service-Name&gt;" --resource-group "&lt;Resource-Group-Name&gt;"</pre>



<p></p>



<p><strong>Example </strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az webapp identity assign --name "thecodebuzz-web-app-service" --resource-group "thecodebuzz-group" </pre>



<p></p>



<p>Once executed successfully,</p>



<p></p>



<p>You shall see the output below,</p>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
{
   &quot;principalId&quot;: &quot;4a6bdc47-xxx-4402-xxxx-fc2861108d1c&quot;,
   &quot;tenantId&quot;: &quot;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&quot;,
   &quot;type&quot;: &quot;SystemAssigned&quot;
 }
</pre></div>


<p></p>



<p></p>



<p>As a next step, please run the below command to set the policy.</p>



<p></p>



<ul class="wp-block-list"><li>The web app application is given permission to do&nbsp;<strong>get</strong>&nbsp;or <strong>list</strong>&nbsp;operations on your key vault bypassing the <strong><em>principalID </em></strong>obtained above </li></ul>



<p></p>



<p><strong>Command</strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az keyvault set-policy --name '&lt;key-Vault-Name&gt;' --object-id &lt;principalId&gt; --secret-permissions get</pre>



<p></p>



<p><strong>Example </strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size"> az keyvault set-policy --name 'thecodebuzz-key-vault' --object-id '4a6bdc47-xxxx-4402-xxxx-fc2861108d1c' secret-permissions get </pre>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-create-asp-net-core-api-or-mvc-application-using-net-6-or-net-5">Create ASP.NET Core API or MVC application using .NET 6 or .NET 5</h2>



<p></p>



<p>Let&#8217;s create our sample application here. Our target will be to deploy the application cloud Azure app service associated with App Service Plan.</p>



<p></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-using-azure-key-vault-service-1024x704.jpg" alt="Secure secrets using Azure KeyVault with examples" class="wp-image-21725" width="542" height="372" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-using-azure-key-vault-service-1024x704.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-using-azure-key-vault-service-300x206.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-using-azure-key-vault-service-768x528.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-using-azure-key-vault-service-1536x1056.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-using-azure-key-vault-service-756x520.jpg 756w, https://thecodebuzz.com/wp-content/uploads/2022/04/secure-api-secrets-using-azure-key-vault-service.jpg 1745w" sizes="auto, (max-width: 542px) 100vw, 542px" /></figure>



<p></p>



<p>Add below two Nuget packages,</p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">Install-Package <a href="https://www.nuget.org/packages/Azure.Security.KeyVault.Secrets" target="_blank" rel="noreferrer noopener">Azure.Security.KeyVault.Secrets</a> -Version 4.3.0</pre>



<p></p>



<p>This library allows you to securely store and control access to tokens, passwords, API keys, and other secrets. This library offers operations to create, retrieve, update, delete, purge, backup, restore, and list the secrets and their versions.</p>



<p></p>



<p>and</p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">Install-Package <a href="https://www.nuget.org/packages/Azure.Identity" target="_blank" rel="noreferrer noopener">Azure.Identity</a> -Version 1.6.0</pre>



<p></p>



<p>This library provides Azure Active Directory token authentication support. </p>



<p></p>



<p>Please add below <em><strong>using namespaces</strong></em>,</p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">using Azure.Identity;

using Azure.Security.KeyVault.Secrets;</pre>



<p></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>You can use the same logic as it is Console/API or other type of Application as well</p></blockquote>



<p></p>



<p>Open your project solution in Visual Studio. Go to<strong><em> Program.cs</em></strong> and add the below-highlighted code</p>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; highlight: [10,11,12,13,14,15,16,17,18,19,20,21,22,23]; title: ; notranslate">
public class Program
    {
        public static void Main(string&#x5B;] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string&#x5B;] args) =&gt;
            Host.CreateDefaultBuilder(args)
            .ConfigureAppConfiguration((context, config) =&gt;
            {
                var settings = config.Build();

                if (!context.HostingEnvironment.IsDevelopment())
                {
                    var keyVaultEndpoint = settings&#x5B;&quot;VaultURI&quot;];
                    if (!string.IsNullOrEmpty(keyVaultEndpoint))
                    {
                        var azureServiceTokenProvider = new AzureServiceTokenProvider();
                        var keyVaultClient = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback));
                        config.AddAzureKeyVault(keyVaultEndpoint, keyVaultClient, new DefaultKeyVaultSecretManager());
                    }
                }

            }).ConfigureWebHostDefaults(webBuilder =&gt;
               {
                   webBuilder.UseStartup&lt;Startup&gt;();
               });
    }
</pre></div>


<p></p>



<p>That&#8217;s all. Now Azure Key Vault credentials will become part of your <strong><em>IConfiguration </em></strong>root object along with all available configurations.</p>



<p></p>



<p>The above steps will help you manage the azure credentials just like any other configuration and hence let you handle updates or edits to key vault secrets based on how you set your configuration in the API or Application pipeline.</p>



<p></p>



<p></p>



<p>For Accessing Azure Key Vault credentials you need to inject the <strong><em><a href="https://www.thecodebuzz.com/createdefaultbuilder-configuration-management-net-core-and-asp-net-core/" target="_blank" rel="noreferrer noopener" title="CreateDefaultBuilder and Configuration Management in .NET">IConfiguration </a></em></strong>interface in the required module of your choice.</p>



<p></p>



<p><strong><em>Example </em></strong></p>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; highlight: [4]; title: ; notranslate">
 public IActionResult Index()
        {

            string keyVaultUrl = _configuration&#x5B;&quot;YourSecreteCode&quot;];

            return Ok(&quot;Your Secrete is -&quot; + keyVaultUrl);
        }
</pre></div>


<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="913" height="166" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/Secure-secrets-using-Azure-KeyVault-using-Visual-Studio-Configure-Managed-identity-C-local-debug.jpg" alt="Secure secrets using Azure KeyVault C#.NET" class="wp-image-21828" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/Secure-secrets-using-Azure-KeyVault-using-Visual-Studio-Configure-Managed-identity-C-local-debug.jpg 913w, https://thecodebuzz.com/wp-content/uploads/2022/04/Secure-secrets-using-Azure-KeyVault-using-Visual-Studio-Configure-Managed-identity-C-local-debug-300x55.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/Secure-secrets-using-Azure-KeyVault-using-Visual-Studio-Configure-Managed-identity-C-local-debug-768x140.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/Secure-secrets-using-Azure-KeyVault-using-Visual-Studio-Configure-Managed-identity-C-local-debug-785x143.jpg 785w" sizes="auto, (max-width: 913px) 100vw, 913px" /></figure>



<p></p>



<p>Similarly, if you hit the WebApp endpoint,</p>



<p></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/04/Secure-secrets-using-Azure-KeyVault-using-Visual-Studio-Configure-Managed-identity-C-Azure-endpoint-1024x350.jpg" alt="" class="wp-image-21830" width="419" height="143" srcset="https://thecodebuzz.com/wp-content/uploads/2022/04/Secure-secrets-using-Azure-KeyVault-using-Visual-Studio-Configure-Managed-identity-C-Azure-endpoint-1024x350.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/04/Secure-secrets-using-Azure-KeyVault-using-Visual-Studio-Configure-Managed-identity-C-Azure-endpoint-300x102.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/04/Secure-secrets-using-Azure-KeyVault-using-Visual-Studio-Configure-Managed-identity-C-Azure-endpoint-768x262.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/04/Secure-secrets-using-Azure-KeyVault-using-Visual-Studio-Configure-Managed-identity-C-Azure-endpoint-785x268.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2022/04/Secure-secrets-using-Azure-KeyVault-using-Visual-Studio-Configure-Managed-identity-C-Azure-endpoint.jpg 1288w" sizes="auto, (max-width: 419px) 100vw, 419px" /></figure>



<p>If you are interested to know non-msi approach by using enviornment variable setup , please visit below article- <a href="https://www.thecodebuzz.com/secure-secrets-using-azure-keyvault-approach-azure-client-secret/" title="Secure secrets using Azure KeyVault -Approach II" target="_blank" rel="noreferrer noopener"><em><strong>Secure secrets using Azure KeyVault -Approach II</strong></em></a></p>



<p></p>



<p><strong><em>Other references :</em></strong></p>



<p></p>



<ul class="has-medium-font-size wp-block-list"><li><a href="https://www.thecodebuzz.com/set-configuration-azure-using-app-service-azure-cli/" target="_blank" rel="noreferrer noopener" title="Set Configuration in Azure using App Service">Set Configuration in Azure using App Service</a></li></ul>



<ul class="has-medium-font-size wp-block-list"><li><a href="https://www.thecodebuzz.com/configuration-in-net-core-2-1/" target="_blank" rel="noreferrer noopener" title="Configuration in ASP.NET Core">Managing Configuration in ASP.NET Core</a></li></ul>



<p></p>



<p></p>



<p style="font-size:18px">Do you have any <strong>comments or ideas or any better </strong>suggestions to share?</p>



<p class="has-small-font-size"></p>



<p style="font-size:18px">Please sound off your comments below.</p>



<p class="has-medium-font-size"></p>



<p class="has-medium-font-size"><strong>Happy Coding </strong>!!</p>



<p></p>



<hr>



<p class=""></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></p><p>The post <a href="https://thecodebuzz.com/secure-secrets-azure-key-vault-examples-csharp-java-python-nodejs/">Secure secrets using Azure KeyVault MSI with examples</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/secure-secrets-azure-key-vault-examples-csharp-java-python-nodejs/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
