{"id":16877,"date":"2020-08-19T06:17:09","date_gmt":"2020-08-19T06:17:09","guid":{"rendered":"https:\/\/www.testpreptraining.com\/tutorial\/?page_id=16877"},"modified":"2022-04-07T04:32:43","modified_gmt":"2022-04-07T04:32:43","slug":"authenticating-using-azure-container-registry","status":"publish","type":"page","link":"https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/","title":{"rendered":"Authenticating using Azure Container Registry"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.testpreptraining.ai\/tutorial\/exam-az-500-microsoft-azure-security-technologies\/\" target=\"_blank\" rel=\"noreferrer noopener\">Go back to AZ-500 Tutorials<\/a><\/p>\n\n\n\n<p>In this tutorial, we will understand several ways of authenticating with an Azure container registry, each of which is applicable to one or more registry usage scenarios.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Authentication Ways<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Individual login with Azure AD<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>If you&#8217;re using your registry to extract photos from a development workstation and push them to a registry you made, sign in using an individual Azure identity.<\/li><li>After that, run the az acr login command in the Azure CLI:<\/li><\/ul>\n\n\n\n<p><strong>Azure CLI<\/strong><\/p>\n\n\n\n<p><em>az acr login &#8211;name &lt;acrName&gt;<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The CLI uses the token produced when you did az login to easily authenticate your session with your registry once you log in with az acr login. The Docker CLI and Docker daemon must, however, be installed to complete the authentication sequence. Also, it&#8217;s possible to run it in your own environment. The Docker client is used by az acr login to set an Azure Active Directory token in the docker.config file.<\/li><li>The credentials caches and subsequent docker commands in your session do not require a username or password once you&#8217;ve logged in.<\/li><li>The token is then used by az acr login for registry access and is valid for 3 hours.<ul><li>So we recommend that before running a docker command first, log in to the registry. And, if your token expires, then you can refresh it by using the az acr login command again to reauthenticate.\u00a0<\/li><\/ul><\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.testpreptraining.ai\/microsoft-azure-security-technologies-az-500-free-practice-test\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" width=\"961\" height=\"150\" src=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ_500-practice-tests-9.png\" alt=\"AZ-500 practice tests\" class=\"wp-image-17926\" srcset=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ_500-practice-tests-9.png 961w, https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ_500-practice-tests-9-750x117.png 750w\" sizes=\"auto, (max-width: 961px) 100vw, 961px\" \/><\/a><\/figure><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>az acr login with &#8211;expose-token<\/strong><\/h4>\n\n\n\n<p>When the Docker daemon isn&#8217;t functioning in your environment, you may need to authenticate using az acr login. For example, you might need to run az acr login in a script in Azure Cloud Shell that provides the Docker CLI but doesn&#8217;t run the Docker daemon.<\/p>\n\n\n\n<p>However, for this scenario, run az acr login first with the &#8211;expose-token parameter.&nbsp;<\/p>\n\n\n\n<p><strong>Azure CLI<\/strong><\/p>\n\n\n\n<p><em>az acr login -name &lt;acrName&gt; &#8211;expose-token<\/em><\/p>\n\n\n\n<p><strong>Output displays the access token, abbreviated here:<\/strong><\/p>\n\n\n\n<p><strong>Console<\/strong><\/p>\n\n\n\n<p><em>{<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&#8220;accessToken&#8221;: &#8220;eyJhbGciOiJSUzI1NiIs[&#8230;]24V7wA&#8221;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&#8220;loginServer&#8221;: &#8220;myregistry.azurecr.io&#8221;<\/em><\/p>\n\n\n\n<p><em>}<\/em><\/p>\n\n\n\n<p>Then, run docker login, passing 00000000-0000-0000-0000-000000000000 taken as the username and use the access token as password:<\/p>\n\n\n\n<p><strong>Console<\/strong><\/p>\n\n\n\n<p><em>docker login myregistry.azurecr.io &#8211;username 00000000-0000-0000-0000-000000000000 &#8211;password eyJhbGciOiJSUzI1NiIs[&#8230;]24V7wA<\/em><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Service principal<\/strong><\/h4>\n\n\n\n<p>If you assign a service principal to your registry, then your application or service can use it for headless authentication. That is, service principals grant registry access to Azure role-based access control (Azure RBAC), and a registry can have many service principals. However, the available roles for a container registry include:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><em>AcrPull: pull<\/em><\/li><li><em>AcrPush: pull and push<\/em><\/li><li><em>Owner: that means pull, push or assign roles to other users<\/em><\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Admin account<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>Each container registry contains an admin user account that is disabled by default. But, you can enable the admin user and manage its credentials in the Azure portal, or by using the Azure CLI or other Azure tools. <ul><li>However, the admin account is currently required for some scenarios for deploying an image from a container registry to certain Azure services.<\/li><\/ul><\/li><li>The admin account is given with two passwords, both of which can be regenerated. However, two passwords allow you to maintain connection to the registry by using one password while you regenerate the other. <\/li><li>And, if the admin account is authorized, then you can pass the username and either password to the docker login command when prompted for basic authentication to the registry. <\/li><li><strong>For example:<\/strong><\/li><\/ul>\n\n\n\n<p><em>docker login myregistry.azurecr.io&nbsp;<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>For enabling the admin user for an existing registry, you can use the &#8211;admin-enabled parameter of the az acr update command in the Azure CLI:<\/li><\/ul>\n\n\n\n<p><strong>Azure CLI<\/strong><\/p>\n\n\n\n<p><em>az acr update -n &lt;acrName&gt; &#8211;admin-enabled true<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>However, you can enable the admin user in the Azure portal by navigating your registry, selecting Access keys under SETTINGS, then Enable under Admin user.<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.testpreptraining.ai\/microsoft-azure-security-technologies-az-500-practice-exam\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" width=\"961\" height=\"150\" src=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ-500-online-course-8.png\" alt=\"Az-500 Online Course container registry authentication concept\" class=\"wp-image-16881\" srcset=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ-500-online-course-8.png 961w, https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ-500-online-course-8-750x117.png 750w\" sizes=\"auto, (max-width: 961px) 100vw, 961px\" \/><\/a><\/figure><\/div>\n\n\n\n<p class=\"has-text-align-right\"><strong>Reference: <\/strong><a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/container-registry\/container-registry-authentication\" target=\"_blank\" rel=\"noreferrer noopener\">Microsoft Documentation<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/www.testpreptraining.ai\/tutorial\/exam-az-500-microsoft-azure-security-technologies\/\" target=\"_blank\" rel=\"noreferrer noopener\"><a href=\"https:\/\/www.testpreptraining.ai\/tutorial\/exam-az-500-microsoft-azure-security-technologies\/\" target=\"_blank\" rel=\"noreferrer noopener\">Go back to AZ-500 Tutorials<\/a><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Go back to AZ-500 Tutorials In this tutorial, we will understand several ways of authenticating with an Azure container registry, each of which is applicable to one or more registry usage scenarios. Authentication Ways Individual login with Azure AD If you&#8217;re using your registry to extract photos from a development workstation and push them to&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-16877","page","type-page","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Authenticating using Azure Container Registry | Microsoft Azure AZ-500<\/title>\n<meta name=\"description\" content=\"Upgrade your skills by learning about authenticating using Azure Container Registry in Microsoft AZ-500 online course and Practice Exam Now!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Authenticating using Azure Container Registry | Microsoft Azure AZ-500\" \/>\n<meta property=\"og:description\" content=\"Upgrade your skills by learning about authenticating using Azure Container Registry in Microsoft AZ-500 online course and Practice Exam Now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/\" \/>\n<meta property=\"og:site_name\" content=\"Testprep Training Tutorials\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-07T04:32:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ_500-practice-tests-9.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/\",\"name\":\"Authenticating using Azure Container Registry | Microsoft Azure AZ-500\",\"isPartOf\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#website\"},\"datePublished\":\"2020-08-19T06:17:09+00:00\",\"dateModified\":\"2022-04-07T04:32:43+00:00\",\"description\":\"Upgrade your skills by learning about authenticating using Azure Container Registry in Microsoft AZ-500 online course and Practice Exam Now!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Authenticating using Azure Container Registry\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#website\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\",\"name\":\"Testprep Training Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.testpreptraining.ai\/tutorial\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#organization\",\"name\":\"Testprep Training\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png\",\"contentUrl\":\"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png\",\"width\":583,\"height\":153,\"caption\":\"Testprep Training\"},\"image\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Authenticating using Azure Container Registry | Microsoft Azure AZ-500","description":"Upgrade your skills by learning about authenticating using Azure Container Registry in Microsoft AZ-500 online course and Practice Exam Now!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/","og_locale":"en_US","og_type":"article","og_title":"Authenticating using Azure Container Registry | Microsoft Azure AZ-500","og_description":"Upgrade your skills by learning about authenticating using Azure Container Registry in Microsoft AZ-500 online course and Practice Exam Now!","og_url":"https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/","og_site_name":"Testprep Training Tutorials","article_modified_time":"2022-04-07T04:32:43+00:00","og_image":[{"url":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ_500-practice-tests-9.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/","url":"https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/","name":"Authenticating using Azure Container Registry | Microsoft Azure AZ-500","isPartOf":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#website"},"datePublished":"2020-08-19T06:17:09+00:00","dateModified":"2022-04-07T04:32:43+00:00","description":"Upgrade your skills by learning about authenticating using Azure Container Registry in Microsoft AZ-500 online course and Practice Exam Now!","breadcrumb":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/authenticating-using-azure-container-registry\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.testpreptraining.ai\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Authenticating using Azure Container Registry"}]},{"@type":"WebSite","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#website","url":"https:\/\/www.testpreptraining.ai\/tutorial\/","name":"Testprep Training Tutorials","description":"","publisher":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.testpreptraining.ai\/tutorial\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#organization","name":"Testprep Training","url":"https:\/\/www.testpreptraining.ai\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png","contentUrl":"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png","width":583,"height":153,"caption":"Testprep Training"},"image":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/16877","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/comments?post=16877"}],"version-history":[{"count":5,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/16877\/revisions"}],"predecessor-version":[{"id":54278,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/16877\/revisions\/54278"}],"wp:attachment":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/media?parent=16877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/categories?post=16877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/tags?post=16877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}