{"id":53463,"date":"2025-07-08T20:25:21","date_gmt":"2025-07-08T10:25:21","guid":{"rendered":"https:\/\/www.cloudproinc.com.au\/?p=53463"},"modified":"2025-07-08T20:25:24","modified_gmt":"2025-07-08T10:25:24","slug":"how-to-authenticate-to-azure-cli-with-a-service-principal","status":"publish","type":"post","link":"https:\/\/cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/","title":{"rendered":"How to Authenticate to Azure CLI with a Service Principal"},"content":{"rendered":"\n<p>In this blog post, we&#8217;ll show you how to authenticate to Azure CLI with a Service Principal and login to Azure.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Azure CLI is a command-line utility written in Python that allows users to manage Azure resources programmatically. It is widely used by DevOps engineers, developers, and IT professionals to automate deployments, configure services, and manage cloud environments efficiently.<\/p>\n\n\n\n<p>A <strong>Service Principal<\/strong> in Azure is a type of security identity used by applications, hosted services, and automated tools to access specific Azure resources. Unlike user accounts, Service Principals are not associated with any particular user. Instead, they are created with restricted permissions to perform specific tasks, enhancing security and automation capabilities.<\/p>\n\n\n\n<p>For example, you can create a Service Principal for Terraform to provision infrastructure in Azure without requiring a user to manually authenticate each time.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"683\" data-src=\"\/wp-content\/uploads\/2025\/07\/image-7-1024x683.png\" alt=\"Autenticate to Azure CLI using a Service Principal\" class=\"wp-image-53464 lazyload\" data-srcset=\"\/wp-content\/uploads\/2025\/07\/image-7-1024x683.png 1024w, \/wp-content\/uploads\/2025\/07\/image-7-300x200.png 300w, \/wp-content\/uploads\/2025\/07\/image-7-768x512.png 768w, \/wp-content\/uploads\/2025\/07\/image-7-1080x720.png 1080w, \/wp-content\/uploads\/2025\/07\/image-7-1280x853.png 1280w, \/wp-content\/uploads\/2025\/07\/image-7-980x653.png 980w, \/wp-content\/uploads\/2025\/07\/image-7-480x320.png 480w, \/wp-content\/uploads\/2025\/07\/image-7.png 1536w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/683;\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-1-create-a-service-principal\">Step 1: Create a Service Principal<\/h2>\n\n\n\n<p>To create a Service Principal, use the following <a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/category\/azure-cli\/\">Azure CLI <\/a>command:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-695025a65808e53d567108dc827d0b6e\"><code>az ad sp create-for-rbac --name \"my-service-principal\" --role contributor --scopes \/subscriptions\/{subscription-id}\/resourceGroups\/{resource-group}<\/code><\/pre>\n\n\n\n<p>Replace the placeholders with your actual subscription ID and target resource group. This command creates a Service Principal with the &#8220;Contributor&#8221; role scoped to the specified resource group. The output will include important credentials: <code>appId<\/code>, <code>password<\/code>, and <code>tenant<\/code>. Be sure to store them securely.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-2-log-in-to-azure-cli-using-the-service-principal\">Step 2: Log in to Azure CLI using the Service Principal<\/h2>\n\n\n\n<p>Once your Service Principal is created, you can use the credentials to log in to Azure CLI. Here&#8217;s how:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-8e033bff57d16424568d14489f482b88\"><code>az login --service-principal --username APP_ID --password  CLIENT_SECRET --tenant TENANT_ID<\/code><\/pre>\n\n\n\n<p>Replace <code>APP_ID<\/code>, <code>CLIENT_SECRET<\/code>, and <code>TENANT_ID<\/code> with the corresponding values from the previous step. This command authenticates your CLI session using the Service Principal, enabling scripts or automation tools to access Azure resources securely.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-benefits-of-using-service-principals\">Benefits of Using Service Principals<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Security<\/strong>: Avoids using personal credentials in automation scripts.<\/li>\n\n\n\n<li><strong>Scoping<\/strong>: Restrict access to specific resources.<\/li>\n\n\n\n<li><strong>Automation<\/strong>: Ideal for CI\/CD pipelines, Terraform, Bicep, and other infrastructure-as-code tools.<\/li>\n<\/ul>\n\n\n\n<p>By leveraging Service Principals, you can build secure, automated workflows that interact with Azure in a controlled and auditable manner. Whether you&#8217;re deploying virtual machines, configuring networks, or managing containers, using a Service Principal with Azure CLI is a best practice that enhances both efficiency and security.<\/p>\n\n\n\n<p>Let us know in the comments how you&#8217;re using Service Principals in your automation workflows!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-faq-is-app-registration-the-same-as-service-principal\">FAQ: Is App Registration the same as Service Principal?<\/h2>\n\n\n\n<p>Not exactly. When you create an App Registration in Azure Active Directory, you\u2019re registering an application that Azure can identify and trust. This App Registration defines the application&#8217;s identity, including redirect URIs, API permissions, and branding.<\/p>\n\n\n\n<p>A Service Principal, on the other hand, is the security identity created for the App Registration in a specific Azure AD tenant. It\u2019s what actually gets assigned roles and permissions. Think of the App Registration as the blueprint and the Service Principal as the instance of that blueprint in your tenant used for authentication and authorization.<\/p>\n\n\n\n<ul class=\"wp-block-yoast-seo-related-links yoast-seo-related-links\">\n<li><a href=\"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2024\/09\/13\/effortless-web-app-deployment-with-azure-cli\/\">Effortless Web App Deployment with Azure CLI<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2024\/08\/20\/hardening-azure-wiz-outpost\/\">Hardening Azure Wiz Outpost<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/2024\/07\/29\/streamlining-entra-id-app-registrations-with-azure-bicep\/\">Streamlining Entra ID App Registrations with Azure Bicep<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2024\/10\/11\/create-an-app-registration-for-microsoft-azure-sdk-for-net\/\">Create an App Registration for Microsoft Azure SDK for .NET<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/cloudproinc.com.au\/index.php\/wiz-security-deployment-services\/\">Wiz Security Deployment Services<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In this blog post, we&#8217;ll show you how to authenticate to Azure CLI with a Service Principal and login to Azure.<\/p>\n","protected":false},"author":1,"featured_media":744,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_yoast_wpseo_focuskw":"How to Authenticate to Azure CLI with a Service Principal","_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"Learn how to authenticate to Azure CLI with a Service Principal and enhance your cloud management and automation.","_yoast_wpseo_opengraph-title":"","_yoast_wpseo_opengraph-description":"","_yoast_wpseo_twitter-title":"","_yoast_wpseo_twitter-description":"","_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[16,50,13],"tags":[],"class_list":["post-53463","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-azure","category-azure-cli","category-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Authenticate to Azure CLI with a Service Principal - CPI Consulting<\/title>\n<meta name=\"description\" content=\"Learn how to authenticate to Azure CLI with a Service Principal and enhance your cloud management and automation.\" \/>\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.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Authenticate to Azure CLI with a Service Principal\" \/>\n<meta property=\"og:description\" content=\"Learn how to authenticate to Azure CLI with a Service Principal and enhance your cloud management and automation.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/\" \/>\n<meta property=\"og:site_name\" content=\"CPI Consulting\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-08T10:25:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-08T10:25:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cloudproinc.com.au\/wp-content\/uploads\/2024\/10\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"CPI Staff\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CPI Staff\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/index.php\\\/2025\\\/07\\\/08\\\/how-to-authenticate-to-azure-cli-with-a-service-principal\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/index.php\\\/2025\\\/07\\\/08\\\/how-to-authenticate-to-azure-cli-with-a-service-principal\\\/\"},\"author\":{\"name\":\"CPI Staff\",\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/#\\\/schema\\\/person\\\/192eeeb0ce91062126ce3822ae88fe6e\"},\"headline\":\"How to Authenticate to Azure CLI with a Service Principal\",\"datePublished\":\"2025-07-08T10:25:21+00:00\",\"dateModified\":\"2025-07-08T10:25:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/index.php\\\/2025\\\/07\\\/08\\\/how-to-authenticate-to-azure-cli-with-a-service-principal\\\/\"},\"wordCount\":495,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/index.php\\\/2025\\\/07\\\/08\\\/how-to-authenticate-to-azure-cli-with-a-service-principal\\\/#primaryimage\"},\"thumbnailUrl\":\"\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp\",\"articleSection\":[\"Azure\",\"Azure CLI\",\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.cloudproinc.com.au\\\/index.php\\\/2025\\\/07\\\/08\\\/how-to-authenticate-to-azure-cli-with-a-service-principal\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/index.php\\\/2025\\\/07\\\/08\\\/how-to-authenticate-to-azure-cli-with-a-service-principal\\\/\",\"url\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/index.php\\\/2025\\\/07\\\/08\\\/how-to-authenticate-to-azure-cli-with-a-service-principal\\\/\",\"name\":\"How to Authenticate to Azure CLI with a Service Principal - CPI Consulting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/index.php\\\/2025\\\/07\\\/08\\\/how-to-authenticate-to-azure-cli-with-a-service-principal\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/index.php\\\/2025\\\/07\\\/08\\\/how-to-authenticate-to-azure-cli-with-a-service-principal\\\/#primaryimage\"},\"thumbnailUrl\":\"\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp\",\"datePublished\":\"2025-07-08T10:25:21+00:00\",\"dateModified\":\"2025-07-08T10:25:24+00:00\",\"description\":\"Learn how to authenticate to Azure CLI with a Service Principal and enhance your cloud management and automation.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/index.php\\\/2025\\\/07\\\/08\\\/how-to-authenticate-to-azure-cli-with-a-service-principal\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.cloudproinc.com.au\\\/index.php\\\/2025\\\/07\\\/08\\\/how-to-authenticate-to-azure-cli-with-a-service-principal\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/index.php\\\/2025\\\/07\\\/08\\\/how-to-authenticate-to-azure-cli-with-a-service-principal\\\/#primaryimage\",\"url\":\"\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp\",\"contentUrl\":\"\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp\",\"width\":1024,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/index.php\\\/2025\\\/07\\\/08\\\/how-to-authenticate-to-azure-cli-with-a-service-principal\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Authenticate to Azure CLI with a Service Principal\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/#website\",\"url\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/\",\"name\":\"Cloud Pro Inc - CPI Consulting Pty Ltd\",\"description\":\"Cloud, AI &amp; Cybersecurity Consulting | Melbourne\",\"publisher\":{\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/#organization\",\"name\":\"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd\",\"url\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/favfinalfile.png\",\"contentUrl\":\"\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/favfinalfile.png\",\"width\":500,\"height\":500,\"caption\":\"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd\"},\"image\":{\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/#\\\/schema\\\/person\\\/192eeeb0ce91062126ce3822ae88fe6e\",\"name\":\"CPI Staff\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g\",\"caption\":\"CPI Staff\"},\"sameAs\":[\"http:\\\/\\\/www.cloudproinc.com.au\"],\"url\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/author\\\/cpiadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Authenticate to Azure CLI with a Service Principal - CPI Consulting","description":"Learn how to authenticate to Azure CLI with a Service Principal and enhance your cloud management and automation.","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.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/","og_locale":"en_US","og_type":"article","og_title":"How to Authenticate to Azure CLI with a Service Principal","og_description":"Learn how to authenticate to Azure CLI with a Service Principal and enhance your cloud management and automation.","og_url":"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/","og_site_name":"CPI Consulting","article_published_time":"2025-07-08T10:25:21+00:00","article_modified_time":"2025-07-08T10:25:24+00:00","og_image":[{"width":1024,"height":1024,"url":"https:\/\/cloudproinc.com.au\/wp-content\/uploads\/2024\/10\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp","type":"image\/webp"}],"author":"CPI Staff","twitter_card":"summary_large_image","twitter_misc":{"Written by":"CPI Staff","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/#article","isPartOf":{"@id":"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/"},"author":{"name":"CPI Staff","@id":"https:\/\/cloudproinc.azurewebsites.net\/#\/schema\/person\/192eeeb0ce91062126ce3822ae88fe6e"},"headline":"How to Authenticate to Azure CLI with a Service Principal","datePublished":"2025-07-08T10:25:21+00:00","dateModified":"2025-07-08T10:25:24+00:00","mainEntityOfPage":{"@id":"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/"},"wordCount":495,"commentCount":0,"publisher":{"@id":"https:\/\/cloudproinc.azurewebsites.net\/#organization"},"image":{"@id":"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2024\/10\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp","articleSection":["Azure","Azure CLI","Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/","url":"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/","name":"How to Authenticate to Azure CLI with a Service Principal - CPI Consulting","isPartOf":{"@id":"https:\/\/cloudproinc.azurewebsites.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/#primaryimage"},"image":{"@id":"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2024\/10\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp","datePublished":"2025-07-08T10:25:21+00:00","dateModified":"2025-07-08T10:25:24+00:00","description":"Learn how to authenticate to Azure CLI with a Service Principal and enhance your cloud management and automation.","breadcrumb":{"@id":"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/#primaryimage","url":"\/wp-content\/uploads\/2024\/10\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp","contentUrl":"\/wp-content\/uploads\/2024\/10\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp","width":1024,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/08\/how-to-authenticate-to-azure-cli-with-a-service-principal\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudproinc.azurewebsites.net\/"},{"@type":"ListItem","position":2,"name":"How to Authenticate to Azure CLI with a Service Principal"}]},{"@type":"WebSite","@id":"https:\/\/cloudproinc.azurewebsites.net\/#website","url":"https:\/\/cloudproinc.azurewebsites.net\/","name":"Cloud Pro Inc - CPI Consulting Pty Ltd","description":"Cloud, AI &amp; Cybersecurity Consulting | Melbourne","publisher":{"@id":"https:\/\/cloudproinc.azurewebsites.net\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudproinc.azurewebsites.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudproinc.azurewebsites.net\/#organization","name":"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd","url":"https:\/\/cloudproinc.azurewebsites.net\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudproinc.azurewebsites.net\/#\/schema\/logo\/image\/","url":"\/wp-content\/uploads\/2022\/01\/favfinalfile.png","contentUrl":"\/wp-content\/uploads\/2022\/01\/favfinalfile.png","width":500,"height":500,"caption":"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd"},"image":{"@id":"https:\/\/cloudproinc.azurewebsites.net\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/cloudproinc.azurewebsites.net\/#\/schema\/person\/192eeeb0ce91062126ce3822ae88fe6e","name":"CPI Staff","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g","caption":"CPI Staff"},"sameAs":["http:\/\/www.cloudproinc.com.au"],"url":"https:\/\/cloudproinc.com.au\/index.php\/author\/cpiadmin\/"}]}},"jetpack_featured_media_url":"\/wp-content\/uploads\/2024\/10\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp","jetpack-related-posts":[{"id":56770,"url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/11\/05\/securely-use-managed-identity-in-production-and-azure-cli-locally\/","url_meta":{"origin":53463,"position":0},"title":"Securely use Managed Identity in Production and Azure CLI Locally","author":"CPI Staff","date":"November 5, 2025","format":false,"excerpt":"A clean pattern: Managed Identity in prod, Azure CLI for local dev. Practical steps, code, and gotchas to keep secrets out and developers productive.","rel":"","context":"In &quot;Azure&quot;","block_context":{"text":"Azure","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/microsoft-azure\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/11\/securely-use-managed-identity-in-production-and-azure-cli-locally.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/11\/securely-use-managed-identity-in-production-and-azure-cli-locally.png 1x, \/wp-content\/uploads\/2025\/11\/securely-use-managed-identity-in-production-and-azure-cli-locally.png 1.5x, \/wp-content\/uploads\/2025\/11\/securely-use-managed-identity-in-production-and-azure-cli-locally.png 2x, \/wp-content\/uploads\/2025\/11\/securely-use-managed-identity-in-production-and-azure-cli-locally.png 3x, \/wp-content\/uploads\/2025\/11\/securely-use-managed-identity-in-production-and-azure-cli-locally.png 4x"},"classes":[]},{"id":784,"url":"https:\/\/cloudproinc.com.au\/index.php\/2024\/10\/11\/create-an-app-registration-for-microsoft-azure-sdk-for-net\/","url_meta":{"origin":53463,"position":1},"title":"Create an App Registration for Microsoft Azure SDK for .NET","author":"CPI Staff","date":"October 11, 2024","format":false,"excerpt":"In this\u00a0\u00a0Azure\u00a0REST API post, I will show you how to create an App Registration for Microsoft Azure SDK for .NET. Azure SDK for .NET allows us to manage Azure programmatically using .NET libraries. Using the SDK, we can create and manage any Azure resource. The Azure SDK for .NET has\u2026","rel":"","context":"In &quot;.NET&quot;","block_context":{"text":".NET","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/net\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2024\/09\/create-an-Azure-AI-Translator-service-using-the-Azure-REST-API.webp","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2024\/09\/create-an-Azure-AI-Translator-service-using-the-Azure-REST-API.webp 1x, \/wp-content\/uploads\/2024\/09\/create-an-Azure-AI-Translator-service-using-the-Azure-REST-API.webp 1.5x, \/wp-content\/uploads\/2024\/09\/create-an-Azure-AI-Translator-service-using-the-Azure-REST-API.webp 2x"},"classes":[]},{"id":53585,"url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/08\/08\/use-azure-managed-identity-with-azure-automation-powershell\/","url_meta":{"origin":53463,"position":2},"title":"Use Azure Managed Identity with Azure Automation PowerShell","author":"CPI Staff","date":"August 8, 2025","format":false,"excerpt":"When running scripts in Azure Automation, authentication is often the trickiest part. Your runbooks might need to connect to Azure services, Microsoft Graph, or other APIs \u2014 and that means handling credentials securely. In this guide, Use Azure Managed Identity with Azure Automation PowerShell, we\u2019ll focus specifically on User-assigned Managed\u2026","rel":"","context":"In &quot;Azure&quot;","block_context":{"text":"Azure","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/microsoft-azure\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/08\/Use-Managed-Identity-Azure-Automation.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/08\/Use-Managed-Identity-Azure-Automation.png 1x, \/wp-content\/uploads\/2025\/08\/Use-Managed-Identity-Azure-Automation.png 1.5x, \/wp-content\/uploads\/2025\/08\/Use-Managed-Identity-Azure-Automation.png 2x"},"classes":[]},{"id":669,"url":"https:\/\/cloudproinc.com.au\/index.php\/2024\/09\/13\/effortless-web-app-deployment-with-azure-cli\/","url_meta":{"origin":53463,"position":3},"title":"Effortless Web App Deployment with Azure CLI","author":"CPI Staff","date":"September 13, 2024","format":false,"excerpt":"This Azure Web Apps article will show how to use az webapp up to for quick deployment of web apps with minimal configuration. Deploying web applications has never been easier, thanks to the Azure CLI's az webapp up command. In this article, we'll explore how to quickly deploy web apps\u2026","rel":"","context":"In &quot;App Service&quot;","block_context":{"text":"App Service","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/app-service\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2024\/09\/How-to-Create-an-Azure-AI-Language-Account-Using-REST-API.webp","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2024\/09\/How-to-Create-an-Azure-AI-Language-Account-Using-REST-API.webp 1x, \/wp-content\/uploads\/2024\/09\/How-to-Create-an-Azure-AI-Language-Account-Using-REST-API.webp 1.5x, \/wp-content\/uploads\/2024\/09\/How-to-Create-an-Azure-AI-Language-Account-Using-REST-API.webp 2x"},"classes":[]},{"id":492,"url":"https:\/\/cloudproinc.com.au\/index.php\/2024\/08\/01\/automating-access-to-microsoft-graph-api-using-azure-pipelines\/","url_meta":{"origin":53463,"position":4},"title":"Automating Access to Microsoft Graph API Using Azure Pipelines","author":"CPI Staff","date":"August 1, 2024","format":false,"excerpt":"This Azure DevOps pipelines article will show how we automate access to Microsoft Graph API using Azure DevOps pipelines. Azure pipelines is an Azure DevOps service that allows us to automate the deployment of applications, services and changes to cloud environments. Microsoft Graph API is the underlining API service that\u2026","rel":"","context":"In &quot;Azure devOps&quot;","block_context":{"text":"Azure devOps","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/azure-devops\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2024\/08\/Automating-Access-to-Microsoft-Graph-Using-Azure-DevOps-Pipelines.webp","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2024\/08\/Automating-Access-to-Microsoft-Graph-Using-Azure-DevOps-Pipelines.webp 1x, \/wp-content\/uploads\/2024\/08\/Automating-Access-to-Microsoft-Graph-Using-Azure-DevOps-Pipelines.webp 1.5x, \/wp-content\/uploads\/2024\/08\/Automating-Access-to-Microsoft-Graph-Using-Azure-DevOps-Pipelines.webp 2x, \/wp-content\/uploads\/2024\/08\/Automating-Access-to-Microsoft-Graph-Using-Azure-DevOps-Pipelines.webp 3x, \/wp-content\/uploads\/2024\/08\/Automating-Access-to-Microsoft-Graph-Using-Azure-DevOps-Pipelines.webp 4x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts\/53463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/comments?post=53463"}],"version-history":[{"count":1,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts\/53463\/revisions"}],"predecessor-version":[{"id":53465,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts\/53463\/revisions\/53465"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/media\/744"}],"wp:attachment":[{"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/media?parent=53463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/categories?post=53463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/tags?post=53463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}