{"id":16879,"date":"2020-08-19T06:38:06","date_gmt":"2020-08-19T06:38:06","guid":{"rendered":"https:\/\/www.testpreptraining.com\/tutorial\/?page_id=16879"},"modified":"2020-08-26T11:17:29","modified_gmt":"2020-08-26T11:17:29","slug":"creating-a-private-container-registry-using-azure-powershell","status":"publish","type":"page","link":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-private-container-registry-using-azure-powershell\/","title":{"rendered":"Creating a private container registry using Azure PowerShell"},"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 learn about Azure container Registry and how to create a private container registry using Azure Powershell.<\/p>\n\n\n\n<p>Azure Container Registry refers to a managed, private Docker container registry service for building, storing, and serving Docker container images.&nbsp;<\/p>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>Prerequisites<\/strong><\/h6>\n\n\n\n<ul class=\"wp-block-list\"><li>Firstly, for this, you must have an Azure PowerShell module. Then, run Get-Module -ListAvailable Az for determining your installed version.&nbsp;<\/li><li>Secondly, you must also have Docker installed locally. That is to say, the docker provides packages for OS like macOS, Windows, and Linux systems.<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Sign in to Azure<\/strong><\/h4>\n\n\n\n<p>For signing in to your Azure subscription with the Connect-AzAccount command:<\/p>\n\n\n\n<p><strong>PowerShell<\/strong><\/p>\n\n\n\n<p><em>Connect-AzAccount<\/em><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Creating resource group<\/strong><\/h4>\n\n\n\n<p>After authenticating with Azure, create a resource group with New-AzResourceGroup. However, a resource group is a logical container in which you deploy and manage your Azure resources.<\/p>\n\n\n\n<p><strong>PowerShell<\/strong><\/p>\n\n\n\n<p><em>New-AzResourceGroup -Name myResourceGroup -Location EastUS<\/em><\/p>\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>Creating container registry<\/strong><\/h4>\n\n\n\n<p>Now, we will create a container registry in a new resource group with the New-AzContainerRegistry command.<\/p>\n\n\n\n<p>However, the registry name must be unique within Azure and should contain 5-50 alphanumeric characters. For example, we will create a registry named &#8220;myContainerRegistry007.&#8221; Replace myContainerRegistry007 in the following command, then run it to create the registry:<\/p>\n\n\n\n<p><strong>PowerShell<\/strong><\/p>\n\n\n\n<p><em>$registry = New-AzContainerRegistry -ResourceGroupName &#8220;myResourceGroup&#8221; -Name &#8220;myContainerRegistry007&#8221; -EnableAdminUser -Sku Basic<\/em><\/p>\n\n\n\n<p>Now, in this, you create a Basic registry, that is a cost-optimized option for developers learning about Azure Container Registry.\u00a0<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Log in to registry<\/strong><\/h4>\n\n\n\n<p>Before pushing and pulling container images, firstly, you must log in to your registry. That is to say, in production scenarios, you must use an individual identity or service principal for container registry access. However, for keeping this quickstart briefing, just enables the admin user on your registry with the Get-AzContainerRegistryCredential command:<\/p>\n\n\n\n<p><strong>PowerShell<\/strong><\/p>\n\n\n\n<p><em>$creds = Get-AzContainerRegistryCredential -Registry $registry<\/em><\/p>\n\n\n\n<p><strong>Next, run docker login to log in:<\/strong><\/p>\n\n\n\n<p><strong>PowerShell<\/strong><\/p>\n\n\n\n<p><em>$creds.Password | docker login $registry.LoginServer -u $creds.Username &#8211;password-stdin<\/em><\/p>\n\n\n\n<p><em>The command returns Login Succeeded once completed.<\/em><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Pushing image to registry<\/strong><\/h4>\n\n\n\n<p>For pushing an image to an Azure Container Registry, you must first have an image. However, if you don&#8217;t yet have any local container images, run the following docker pull command to pull an existing image from Docker Hub. For example, given, pull the hello-world image.<\/p>\n\n\n\n<p><em>docker pull hello-world<\/em><\/p>\n\n\n\n<p>Before pushing an image to your registry, first, tag it with the fully qualified name of your registry login server. However, the login server name is in the format &lt;registry-name&gt;.azurecr.io (all lowercase), for example, mycontainerregistry.azurecr.io.<\/p>\n\n\n\n<p>Tag the image using the docker tag command. Replace &lt;login-server&gt; with the login server name of your ACR instance.<\/p>\n\n\n\n<p><em>docker tag hello-world &lt;login-server&gt;\/hello-world:v1<\/em><\/p>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>Example:<\/strong><\/h6>\n\n\n\n<p><em>docker tag hello-world mycontainerregistry.azurecr.io\/hello-world:v1<\/em><\/p>\n\n\n\n<p>Lastly, use the docker push to push the image to the registry instance. After that, replace &lt;login-server&gt; with the login server name of your registry instance. For example, let&#8217;s create the hello-world repository, containing the hello-world:v1 image.<\/p>\n\n\n\n<p><em>docker push &lt;login-server&gt;\/hello-world:v1<\/em><\/p>\n\n\n\n<p>However, after pushing the image to the container registry, remove the hello-world:v1 image from your local Docker environment.&nbsp;<\/p>\n\n\n\n<p><em>docker rmi &lt;login-server&gt;\/hello-world:v1<\/em><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Run image from registry<\/strong><\/h4>\n\n\n\n<p>Now, you can pull and run the hello-world:v1 container image from your container registry by using docker run:<\/p>\n\n\n\n<p><em>docker run &lt;login-server&gt;\/hello-world:v1&nbsp;&nbsp;<\/em><\/p>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>Example output:<\/strong><\/h6>\n\n\n\n<p><em>Unable to find image &#8216;mycontainerregistry.azurecr.io\/hello-world:v1&#8217; locally<\/em><\/p>\n\n\n\n<p><em>v1: Pulling from hello-world<\/em><\/p>\n\n\n\n<p><em>Digest: sha256:662dd8e65ef7ccf13f417962c2f77567d3b132f12c95909de6c85ac3c326a345<\/em><\/p>\n\n\n\n<p><em>Status: Downloaded newer image for mycontainerregistry.azurecr.io\/hello-world:v1<\/em><\/p>\n\n\n\n<p><em>Hello from Docker!<\/em><\/p>\n\n\n\n<p><em>This message shows that your installation is working correctly.<\/em><\/p>\n\n\n\n<p><em>[&#8230;]<\/em><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Cleaning up resources<\/strong><\/h4>\n\n\n\n<p>After finishing working with the resources you created in this quickstart, firstly, use the Remove-AzResourceGroup command for removing the resource group. Further, it also removes the container registry, and the container images stored there using the command:<\/p>\n\n\n\n<p><strong>PowerShell<\/strong><\/p>\n\n\n\n<p><em>Remove-AzResourceGroup -Name myResourceGroup<\/em><\/p>\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 private container registry using Azure PowerShell 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-get-started-powershell\" 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 learn about Azure container Registry and how to create a private container registry using Azure Powershell. Azure Container Registry refers to a managed, private Docker container registry service for building, storing, and serving Docker container images.&nbsp; Prerequisites Firstly, for this, you must have an Azure&#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-16879","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>Creating a private container registry using Azure PowerShell | AZ-500<\/title>\n<meta name=\"description\" content=\"Increase your skills by learning about creating a private container registry using Azure PowerShell in Microsoft AZ-500 online course 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\/creating-a-private-container-registry-using-azure-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating a private container registry using Azure PowerShell | AZ-500\" \/>\n<meta property=\"og:description\" content=\"Increase your skills by learning about creating a private container registry using Azure PowerShell in Microsoft AZ-500 online course Now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-private-container-registry-using-azure-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"Testprep Training Tutorials\" \/>\n<meta property=\"article:modified_time\" content=\"2020-08-26T11:17:29+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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-private-container-registry-using-azure-powershell\/\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-private-container-registry-using-azure-powershell\/\",\"name\":\"Creating a private container registry using Azure PowerShell | AZ-500\",\"isPartOf\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#website\"},\"datePublished\":\"2020-08-19T06:38:06+00:00\",\"dateModified\":\"2020-08-26T11:17:29+00:00\",\"description\":\"Increase your skills by learning about creating a private container registry using Azure PowerShell in Microsoft AZ-500 online course Now!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-private-container-registry-using-azure-powershell\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-private-container-registry-using-azure-powershell\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-private-container-registry-using-azure-powershell\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating a private container registry using Azure PowerShell\"}]},{\"@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":"Creating a private container registry using Azure PowerShell | AZ-500","description":"Increase your skills by learning about creating a private container registry using Azure PowerShell in Microsoft AZ-500 online course 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\/creating-a-private-container-registry-using-azure-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Creating a private container registry using Azure PowerShell | AZ-500","og_description":"Increase your skills by learning about creating a private container registry using Azure PowerShell in Microsoft AZ-500 online course Now!","og_url":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-private-container-registry-using-azure-powershell\/","og_site_name":"Testprep Training Tutorials","article_modified_time":"2020-08-26T11:17:29+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":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-private-container-registry-using-azure-powershell\/","url":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-private-container-registry-using-azure-powershell\/","name":"Creating a private container registry using Azure PowerShell | AZ-500","isPartOf":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#website"},"datePublished":"2020-08-19T06:38:06+00:00","dateModified":"2020-08-26T11:17:29+00:00","description":"Increase your skills by learning about creating a private container registry using Azure PowerShell in Microsoft AZ-500 online course Now!","breadcrumb":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-private-container-registry-using-azure-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-private-container-registry-using-azure-powershell\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-private-container-registry-using-azure-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.testpreptraining.ai\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Creating a private container registry using Azure PowerShell"}]},{"@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\/16879","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=16879"}],"version-history":[{"count":3,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/16879\/revisions"}],"predecessor-version":[{"id":17950,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/16879\/revisions\/17950"}],"wp:attachment":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/media?parent=16879"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/categories?post=16879"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/tags?post=16879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}