question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot install AADLoginForLinux via Azure Resource Manager Template

See original GitHub issue

The AAD Login for Linux is a great improvement for identity and access management of Linux servers in Azure. My team relies on Azure Resource Manager template to deploy applications and infrastructure. I would like to have these server deployments include adding the AAD Login for Linux extension. Unfortunately, I am encountering errors and cannot figure out how to resolve.

This the error returned from deployment { "id": "/subscriptions/.../resourceGroups/jenkins-devapps-rg/providers/Microsoft.Resources/deployments/initTemplate/operations/DE946D2D62CFD93C", "operationId": "DE946D2D62CFD93C", "properties": { "provisioningOperation": "Create", "provisioningState": "Failed", "timestamp": "2019-07-04T00:53:35.3932443Z", "duration": "PT2M53.1727507S", "trackingId": "cdbefe00-8b87-4af4-a4e9-ca0cbaa96cce", "statusCode": "Conflict", "statusMessage": { "status": "Failed", "error": { "code": "ResourceDeploymentFailure", "message": "The resource operation completed with terminal provisioning state 'Failed'.", "details": [ { "code": "VMExtensionProvisioningError", "message": "VM has reported a failure when processing extension 'AADLoginForLinux'. Error message: \"Failed to get status file [Errno 2] No such file or directory: '/var/lib/waagent/Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.8370001/status/0.status'\"." } ] } }, "targetResource": { "id": "/subscriptions/.../resourceGroups/jenkins-devapps-rg/providers/Microsoft.Compute/virtualMachines/jenkins-vm/extensions/AADLoginForLinux", "resourceType": "Microsoft.Compute/virtualMachines/extensions", "resourceName": "jenkins-vm/AADLoginForLinux" } }}

This snippet is taken from the template file being used in the deployment that results in the above posted error. { "apiVersion": "2019-03-01", "location": "[parameters('location')]", "name": "[concat(parameters('vmName'), '/AADLoginForLinux')]", "properties": { "autoUpgradeMinorVersion": true, "publisher": "Microsoft.Azure.ActiveDirectory.LinuxSSH", "protectedSettings": {}, "settings": {}, "type": "AADLoginForLinux", "typeHandlerVersion": "1.0" }, "type": "Microsoft.Compute/virtualMachines/extensions" }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:9

github_iconTop GitHub Comments

2reactions
jleonelioncommented, Dec 23, 2019

Through some trial and error, I figured out how to specify the AADLinux extension for a VM defined in an ARM Template. It really came down to getting the right values for “publisher”, “type” and “typeHandlerVersion” right. For future reference, see below example:

    {
      "apiVersion": "2019-03-01",
      "dependsOn": [
        "[variables('vmName')]"
      ],
      "location": "[parameters('location')]",
      "name": "[concat(variables('vmName'), '/AADLoginForLinux')]",
      "properties": {
        "autoUpgradeMinorVersion": true,
        "publisher": "Microsoft.Azure.ActiveDirectory.LinuxSSH",
        "type": "AADLoginForLinux",
        "typeHandlerVersion": "1.0"
      },
      "type": "Microsoft.Compute/virtualMachines/extensions"
    },   
0reactions
gmichelscommented, Oct 2, 2020

I see a similar issue with scale sets and terraform, where the error is slightly different:

2020-10-02T01:39:41.062851Z INFO ExtHandler [Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.8370001] Enable extension [./installer.sh enable]
2020-10-02T01:39:53.090107Z WARNING ExtHandler ExtHandler [PERIODIC] We couldn't read any status for Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.8370001 extension, for the sequence number 1. It failed due to [ExtensionStatusError] [Errno 2] No such file or directory: '/var/lib/waagent/Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.8370001/status/1.status'
Inner error: [Errno 2] No such file or directory: '/var/lib/waagent/Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.8370001/status/1.status'

The extension is installed just fine via az vmss extension set, the problem only happens when doing via terraform.

I noticed a discrepancy in the output when writing the settings file via terraform:

2020-10-02T01:39:09.014743Z INFO ExtHandler [Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.8370001] Initializing extension Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.8370001
2020-10-02T01:39:09.015959Z INFO ExtHandler [Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.8370001] Update settings file: 1.settings
2020-10-02T01:39:09.016229Z INFO ExtHandler [Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.8370001] Install extension [./installer.sh install]

And via Azure CLI:

2020-10-02T01:45:52.574789Z INFO ExtHandler [Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.8370001] Initializing extension Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.8370001
2020-10-02T01:45:52.586165Z INFO ExtHandler [Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.8370001] Extension has no settings, write empty 0.settings
2020-10-02T01:45:52.595566Z INFO ExtHandler [Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.8370001] Install extension [./installer.sh install]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot install AADLoginForLinux via Azure Resource Manager ...
My team relies on Azure Resource Manager template to deploy applications and infrastructure. I would like to have these server deployments include adding...
Read more >
Log in to a Linux virtual machine in Azure by using Azure AD ...
Sign in to the Azure portal by using an account that has access to create VMs, and then select + Create a resource....
Read more >
Azure VM extensions and features for Linux - Microsoft Learn
You can run Azure VM extensions by using the Azure CLI, PowerShell, Azure Resource Manager templates (ARM templates), and the Azure portal.
Read more >
Troubleshoot common Azure deployment errors
Error code Mitigation More inform... AccountNameInvalid Follow naming guidelines for storage accounts. Resolve erro... AccountPropertyCannotBeSet Check available storage account properties. storageAcco... AnotherOperationInProgress Wait for concurrent operation...
Read more >
Resource not found errors - Azure Resource Manager
For example, if you try to add tags to a resource that doesn't exist, ... If you're using PowerShell or Azure CLI, check...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found