az login fails with NativeCommandError
in Powershell ISE
#30651
Labels
Account
az login/account
AKS
az aks/acs/openshift
ARM
az resource/group/lock/tag/deployment/policy/managementapp/account management-group
Auto-Assign
Auto assign by bot
Azure CLI Team
The command of the issue is owned by Azure CLI team
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
needs-team-triage
This issue needs the team to triage.
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
RBAC
az role
Milestone
Describe the bug
when i try to do az login through my command it is showing like this az : WARNING: Select the account you want to log in with. For more information on login with Azure CLI, see https://go.microsoft.com/fwlink/?linkid=2271136
At line:29 char:1
but when i do az login it is working i am using powershell ise
Related command
this is my powershell script #------------------------------------------------------------USER INPUT PART-------------------------------------------------------------------------------------------
$ErrorActionPreference = "Stop"
Taking necessary credentials from User
do {
$tenantId = Read-Host 'Enter the Tenant Id'
if (!$tenantId) {
Write-Verbose -Message "Tenant Id is Mandatory, Please input Tenant Id" -Verbose
}
} while (!$tenantId)
do {
$subscriptionId = Read-Host 'Enter the Subscription Id'
if (!$subscriptionId) {
Write-Verbose -Message "SubscriptionId is Mandatory, Please input Subscription Id" -Verbose
}
} while (!$subscriptionId)
do {
$resourceGroupName = Read-Host 'Enter the Managed Resource Group Name'
if (!$resourceGroupName) {
Write-Verbose -Message "Managed Resource Group Name is Mandatory, Please input Resource Group Name" -Verbose
}
} while (!$resourceGroupName)
echo 'Login to Azure with your azure login Id and password'
az login
Connect-AzAccount -Subscription $subscriptionId -Tenant $tenantId
az account set --subscription $subscriptionId
Fetch All AKS Clusters in the Resource Group
$clusters = Get-AzResource -ResourceGroupName $resourceGroupName -ResourceType "Microsoft.ContainerService/managedClusters"
if (!$clusters) {
Write-Error "No AKS clusters found in resource group $resourceGroupName"
exit
}
Loop Through Each Cluster and Apply Operations
foreach ($cluster in $clusters) {
$clusterName = $cluster.Name
Write-Host "Processing Cluster: $clusterName"
apiVersion: "aadpodidentity.k8s.io/v1"
kind: AzureIdentity
metadata:
name: $userManagedIdentityName
spec:
type: 0
resourceID: /subscriptions/$subscriptionId/resourcegroups/$resourceGroupName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/$userManagedIdentityName
clientID: $userManagedIdentityClientId
"@
apiVersion: "aadpodidentity.k8s.io/v1"
kind: AzureIdentityBinding
metadata:
name: ${userManagedIdentityName}-binding
spec:
azureIdentity: $userManagedIdentityName
selector: $userManagedIdentityName
"@
apiVersion: apps/v1
kind: Deployment
metadata:
name: plt-deployment-$clusterName
spec:
replicas: 1
selector:
matchLabels:
app: my-value
template:
metadata:
labels:
app: my-value
aadpodidbinding: $userManagedIdentityName
spec:
containers:
- name: my-app-container
image: powerbiload.azurecr.io/internaltestjob:latest
env:
- name: SQLSERVER
value: "${serverName}.database.windows.net"
- name: DATABASE
value: $databaseName
- name: MANAGEDIDENTITY
value: $userManagedIdentityName
- name: NODECOUNT
value: "$kubeNodeCount"
- name: SUBSCRIPTIONID
value: $subscriptionId
- name: RESOURCEGROUP
value: $resourceGroupName
- name: CLUSTERNAME
value: $clusterName
"@
$deploymentYaml | kubectl.exe apply -f -
}
Write-Host "All clusters have been processed."
Errors
az : WARNING: Select the account you want to log in with. For more information on login with Azure CLI, see https://go.microsoft.com/fwlink/?linkid=2271136
At line:29 char:1
Issue script & Debug output
it should login my account
Expected behavior
it should login after selecting the account
Environment Summary
Additional context
No response
The text was updated successfully, but these errors were encountered: