Azure / Azure/azure-powershell

ERROR: Failed to connect to MSI. Please make sure MSI is configured correctly.

Open
#25,492 0 comments 0 reactions 1 assignee Claimed by @VeryEarly View on GitHub
bug customer-reported
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

Getting error: ERROR: Failed to connect to MSI. Please make sure MSI is configured correctly.

### Issue script & Debug output

```PowerShell
Param( [string]$appName )

if (!$appName)
{
Write-Host "appName is null"
exit 1
}

"Creating AAD app $appName..."
$app = az ad app create --display-name $appName --sign-in-audience AzureADMyOrg --required-resource-accesses manifest.json | ConvertFrom-Json

# wait for the AAD app to be created or the script will fail later on
"Waiting for the app to be fully provisioned..."
Start-Sleep -Seconds 10
Write-Host $app
Write-Host $LASTEXITCODE

exit 2
# add current user as app owner Set-AzureADApplication -ObjectId "5e33af72-0926-4211-a9d2-ecd197fd7a60" -PublisherDomain "portdebarcelona.cat"
# az ad app update --id 5e33af72-0926-4211-a9d2-ecd197fd7a60 --set publisherDomain=portdebarcelona.cat
# Property 'publisherDomain' is read-only and cannot be set.
"Adding current user as app owner..."
$userId = az ad signed-in-user show --query id -o tsv
az ad app owner add --id $app.appId --owner-object-id $userId

$appSecret = az ad app credential reset --id $app.appId --display-name "ForWebApp" --years 2 | ConvertFrom-Json

""
"AppId=$($app.appId)"
"AppPassword=$($appSecret.password)"

az ad sp create --id $app.appId
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 7.4.3
PSEdition Core
GitCommitId 7.4.3
OS CBL-Mariner/Linux
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```

### Module versions

```PowerShell
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 3.0.0 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzConte…
Script 8.0.0 Az.Compute {Add-AzImageDataDisk, Add-AzVhd, Add-AzVMAddition…
Script 7.6.0 Az.Network {Add-AzApplicationGatewayAuthenticationCertificat…
Script 7.1.0 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, G…
Script 7.0.0 Az.Storage {Add-AzRmStorageContainerLegalHold, Add-AzStorage…
Script 1.1.3 Az.Tools.Predictor {Disable-AzPredictor, Enable-AzPredictor, Open-Az…
Script 0.0.0.10 AzureAD.Standard.Preview {Add-AzureADApplicationOwner, Add-AzureADDeviceRe…
Script 0.9.3 AzurePSDrive
```

### Error output

```PowerShell
ERROR: Failed to connect to MSI. Please make sure MSI is configured correctly.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.