{"id":5184,"date":"2024-11-14T03:51:48","date_gmt":"2024-11-14T03:51:48","guid":{"rendered":"https:\/\/www.liainfraservices.com\/blog\/?p=5184"},"modified":"2025-03-14T09:47:54","modified_gmt":"2025-03-14T09:47:54","slug":"how-to-authenticate-terraform-with-azure","status":"publish","type":"post","link":"https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/","title":{"rendered":"How to authenticate terraform with azure"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">min read<\/span><\/span><div class='epvc-post-count'><span class='epvc-eye'><\/span>  <span class=\"epvc-count\"> 3,170<\/span><\/div>\n<p class=\"wp-block-paragraph\"><strong>This article will show how to authenticate terraform <\/strong>using Azure\u00a0Service Principal.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But, before we start, let`s see some background on what we do for our known AWS, so that we can easily relate what we are doing and what are we trying to achieve.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To authenticate terraform with aws, we do something like this<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We create an IAM user for programmatic access with admin access and make a note of the access\/secret key<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>On the client machine(terraform host), create a profile `aws configure &#8211;profile tf-user` with the above access\/secret key and<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>then when we create terraform provider, we add that profile for tf to authenticate with AWS<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>provider \"aws\" {\n\nregion = \"ap-south-1\"\n\nprofile = \"tf-user\"\n\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now, if we understood what are we going to achieve, then let`s move to get the same for Azure cloud.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How TF authenticate with Azure cloud?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First we have to create an identity (Service Principal) on azure &amp; then <\/li>\n\n\n\n<li>add that to tf provider for azure<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">To create a Service Principal(Identity) in Azure via the Azure Portal, follow these steps:<\/span><\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1.Register an app in Azure (<code>terraform<\/code>)<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Log in to Azure Portal: <code>portal.azure.com<\/code> and login<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Navigate to Azure Active Directory (Entra ID):click on <code>App registrations<\/code> from the left side<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Click on <code>New registration<\/code> at the top.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Fill in the App Registration Details:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"887\" src=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/entra-app-registration-1024x887.png\" alt=\"\" class=\"wp-image-5185\" srcset=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/entra-app-registration-1024x887.png 1024w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/entra-app-registration-300x260.png 300w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/entra-app-registration-768x665.png 768w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/entra-app-registration-1536x1330.png 1536w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/entra-app-registration.png 1852w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Generate a Client Secret:<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; click on the created app (for our case its  <kbd>terraform<\/kbd>)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; In the left-hand menu, under Manage, click on <code>Certificates &amp; secrets<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Under the Client secrets section, click  <code>New client secret<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Provide a description (e.g., Terraform secret) and select an expiry period (Example: 1 year, 2 years).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Click Add.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; The secret value will be generated and displayed. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Copy this value immediately and save it in a secure place, as this won&#8217;t be able to available once we leave the page. <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This will be the <code>client secret<\/code>.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Get the Application (Client) ID and Directory (Tenant) ID:<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Navigate back to the Overview section of the App Registration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Copy these<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; <code>Application (client) ID<\/code>: This is the unique identifier for the Service Principal (copy and save it).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; <code>Directory (tenant) ID<\/code>: This is your Azure AD tenant ID (copy and save it).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"394\" src=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/app-id-1024x394.png\" alt=\"\" class=\"wp-image-5186\" srcset=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/app-id-1024x394.png 1024w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/app-id-300x115.png 300w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/app-id-768x295.png 768w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/app-id-1536x591.png 1536w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/app-id.png 1664w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. Assign Required Role to the Service Principal:<\/strong> (Subscription Level)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Now that we have the Service Principal (App Registration <kbd>terraform<\/kbd> app) created, we need to give it the proper permissions to manage resources (Eample : AKS, or other Azure services).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Go to the Subscriptions section in the portal. we need to give IAM access to that app in the subscription level<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Select the subscription where the resources(aks or other azure resources) needs to be deployed using Terraform. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; On the left-hand menu, select <code>Access control (IAM).<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Click on + Add \u2192 Add role assignment.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"484\" src=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/app-iam-1024x484.png\" alt=\"\" class=\"wp-image-5187\" srcset=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/app-iam-1024x484.png 1024w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/app-iam-300x142.png 300w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/app-iam-768x363.png 768w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/app-iam.png 1480w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Choose the appropriate role:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; For AKS: Contributor or Owner (generally we use this role).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; For Terraform, Contributor is often sufficient.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; In the Assign access to dropdown, select User, group, or service principal.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Search for the name of the Service Principal (the name of the app registration you created earlier). <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Select the Service Principal, and then click Save. (See the image below)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"276\" src=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/add-sp-subscription-1024x276.png\" alt=\"\" class=\"wp-image-5191\" srcset=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/add-sp-subscription-1024x276.png 1024w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/add-sp-subscription-300x81.png 300w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/add-sp-subscription-768x207.png 768w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/add-sp-subscription-1536x413.png 1536w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/add-sp-subscription-2048x551.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Add this Service Principle account into the terraform provider<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>provider \"azurerm\" {\n\n# Configuration options\n\nsubscription_id = \"618674c\"\n\nclient_id = \"23ce2\"\n\nclient_secret = \"hHHbwW\"\n\ntenant_id = \"6f864\"\n\nfeatures {}\n\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Now the TF can be authenticated with Azure to interact with, through API<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">min read<\/span><\/span>3,170 This article will show how to authenticate terraform using Azure\u00a0Service Principal. But, before we start, let`s see some background on what we do for our known AWS, so that<\/p>\n","protected":false},"author":1,"featured_media":5303,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"footnotes":""},"categories":[971],"tags":[],"class_list":["post-5184","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to authenticate terraform with azure - Blog | Liainfraservices<\/title>\n<meta name=\"description\" content=\"Learn how to authenticate Terraform with Azure using a Service Principal. This step-by-step guide covers creating an identity in Azure, generating a client secret, and setting up the configurations for seamless integration, ensuring secure and efficient deployments.\" \/>\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.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to authenticate terraform with azure - Blog | Liainfraservices\" \/>\n<meta property=\"og:description\" content=\"Learn how to authenticate Terraform with Azure using a Service Principal. This step-by-step guide covers creating an identity in Azure, generating a client secret, and setting up the configurations for seamless integration, ensuring secure and efficient deployments.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog | Liainfraservices\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-14T03:51:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-14T09:47:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/How-to-authenticate-terraform-with-azure_1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2240\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Partho\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Partho\" \/>\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.liainfraservices.com\\\/blog\\\/how-to-authenticate-terraform-with-azure\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-authenticate-terraform-with-azure\\\/\"},\"author\":{\"name\":\"Partho\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#\\\/schema\\\/person\\\/b5a729cb152dd3bc7f07550ca9d223e4\"},\"headline\":\"How to authenticate terraform with azure\",\"datePublished\":\"2024-11-14T03:51:48+00:00\",\"dateModified\":\"2025-03-14T09:47:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-authenticate-terraform-with-azure\\\/\"},\"wordCount\":538,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-authenticate-terraform-with-azure\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/How-to-authenticate-terraform-with-azure_1.png\",\"articleSection\":[\"devops\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-authenticate-terraform-with-azure\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-authenticate-terraform-with-azure\\\/\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-authenticate-terraform-with-azure\\\/\",\"name\":\"How to authenticate terraform with azure - Blog | Liainfraservices\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-authenticate-terraform-with-azure\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-authenticate-terraform-with-azure\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/How-to-authenticate-terraform-with-azure_1.png\",\"datePublished\":\"2024-11-14T03:51:48+00:00\",\"dateModified\":\"2025-03-14T09:47:54+00:00\",\"description\":\"Learn how to authenticate Terraform with Azure using a Service Principal. This step-by-step guide covers creating an identity in Azure, generating a client secret, and setting up the configurations for seamless integration, ensuring secure and efficient deployments.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-authenticate-terraform-with-azure\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-authenticate-terraform-with-azure\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-authenticate-terraform-with-azure\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/How-to-authenticate-terraform-with-azure_1.png\",\"contentUrl\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/How-to-authenticate-terraform-with-azure_1.png\",\"width\":2240,\"height\":1260,\"caption\":\"How to authenticate terraform with azure\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-authenticate-terraform-with-azure\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"devops\",\"item\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/category\\\/devops\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to authenticate terraform with azure\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/\",\"name\":\"Blog | Liainfraservices\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#organization\",\"name\":\"Blog | Liainfraservices\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/lia-logo-b-e1635340384244.png\",\"contentUrl\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/lia-logo-b-e1635340384244.png\",\"width\":308,\"height\":96,\"caption\":\"Blog | Liainfraservices\"},\"image\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#\\\/schema\\\/person\\\/b5a729cb152dd3bc7f07550ca9d223e4\",\"name\":\"Partho\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g\",\"caption\":\"Partho\"},\"description\":\"Partho Das, founder of Lia Infraservices, has 15+ years of expertise in cloud solutions, DevOps, and infrastructure security. He provides consultation on architecture planning, DevOps setup, Kubernetes, and cloud migrations. Partho holds multiple AWS and Azure certifications, along with CISCO CCNA &amp; CCNP. Connect on LinkedIn\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/partho-dev\\\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to authenticate terraform with azure - Blog | Liainfraservices","description":"Learn how to authenticate Terraform with Azure using a Service Principal. This step-by-step guide covers creating an identity in Azure, generating a client secret, and setting up the configurations for seamless integration, ensuring secure and efficient deployments.","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.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/","og_locale":"en_US","og_type":"article","og_title":"How to authenticate terraform with azure - Blog | Liainfraservices","og_description":"Learn how to authenticate Terraform with Azure using a Service Principal. This step-by-step guide covers creating an identity in Azure, generating a client secret, and setting up the configurations for seamless integration, ensuring secure and efficient deployments.","og_url":"https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/","og_site_name":"Blog | Liainfraservices","article_published_time":"2024-11-14T03:51:48+00:00","article_modified_time":"2025-03-14T09:47:54+00:00","og_image":[{"width":2240,"height":1260,"url":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/How-to-authenticate-terraform-with-azure_1.png","type":"image\/png"}],"author":"Partho","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Partho","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/#article","isPartOf":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/"},"author":{"name":"Partho","@id":"https:\/\/www.liainfraservices.com\/blog\/#\/schema\/person\/b5a729cb152dd3bc7f07550ca9d223e4"},"headline":"How to authenticate terraform with azure","datePublished":"2024-11-14T03:51:48+00:00","dateModified":"2025-03-14T09:47:54+00:00","mainEntityOfPage":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/"},"wordCount":538,"commentCount":0,"publisher":{"@id":"https:\/\/www.liainfraservices.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/#primaryimage"},"thumbnailUrl":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/How-to-authenticate-terraform-with-azure_1.png","articleSection":["devops"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/","url":"https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/","name":"How to authenticate terraform with azure - Blog | Liainfraservices","isPartOf":{"@id":"https:\/\/www.liainfraservices.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/#primaryimage"},"image":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/#primaryimage"},"thumbnailUrl":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/How-to-authenticate-terraform-with-azure_1.png","datePublished":"2024-11-14T03:51:48+00:00","dateModified":"2025-03-14T09:47:54+00:00","description":"Learn how to authenticate Terraform with Azure using a Service Principal. This step-by-step guide covers creating an identity in Azure, generating a client secret, and setting up the configurations for seamless integration, ensuring secure and efficient deployments.","breadcrumb":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/#primaryimage","url":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/How-to-authenticate-terraform-with-azure_1.png","contentUrl":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/How-to-authenticate-terraform-with-azure_1.png","width":2240,"height":1260,"caption":"How to authenticate terraform with azure"},{"@type":"BreadcrumbList","@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-authenticate-terraform-with-azure\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.liainfraservices.com\/blog\/"},{"@type":"ListItem","position":2,"name":"devops","item":"https:\/\/www.liainfraservices.com\/blog\/category\/devops\/"},{"@type":"ListItem","position":3,"name":"How to authenticate terraform with azure"}]},{"@type":"WebSite","@id":"https:\/\/www.liainfraservices.com\/blog\/#website","url":"https:\/\/www.liainfraservices.com\/blog\/","name":"Blog | Liainfraservices","description":"","publisher":{"@id":"https:\/\/www.liainfraservices.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.liainfraservices.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.liainfraservices.com\/blog\/#organization","name":"Blog | Liainfraservices","url":"https:\/\/www.liainfraservices.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.liainfraservices.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2021\/10\/lia-logo-b-e1635340384244.png","contentUrl":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2021\/10\/lia-logo-b-e1635340384244.png","width":308,"height":96,"caption":"Blog | Liainfraservices"},"image":{"@id":"https:\/\/www.liainfraservices.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.liainfraservices.com\/blog\/#\/schema\/person\/b5a729cb152dd3bc7f07550ca9d223e4","name":"Partho","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g","caption":"Partho"},"description":"Partho Das, founder of Lia Infraservices, has 15+ years of expertise in cloud solutions, DevOps, and infrastructure security. He provides consultation on architecture planning, DevOps setup, Kubernetes, and cloud migrations. Partho holds multiple AWS and Azure certifications, along with CISCO CCNA &amp; CCNP. Connect on LinkedIn","sameAs":["https:\/\/www.linkedin.com\/in\/partho-dev\/"]}]}},"_links":{"self":[{"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/posts\/5184","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/comments?post=5184"}],"version-history":[{"count":4,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/posts\/5184\/revisions"}],"predecessor-version":[{"id":5192,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/posts\/5184\/revisions\/5192"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/media\/5303"}],"wp:attachment":[{"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/media?parent=5184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/categories?post=5184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/tags?post=5184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}