I am geeting the error while I try to attach the Azure Container Registry to the AKS using Visual studio
syntax:
az aks update --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --attach-acr $ACR_NAME
Error:
microsoft.containerregistry/registries' could not be found in subscription
I have logged into the correct subscription and also set the correct subscription
az login --tenant $TENANT_ID
az account set --subscription $SUBSCRIPTION
az acr list also shows me the acr that is created
any possible solution for this?
Tested in my environment it is working fine for me, The error you are getting is due to you are looking into wrong subscription. When you use the CLI command az login then you log in with a default subscription. For you, it seems the "Some Other susbscription" is the default. You should check if your registry is in the current subscription. If not, you should set that subscription as the current subscription through the CLI command:
az account set --subscription subscription_id
Now would suggest you to check if the registry exists in current subscription with the CLI command:
az acr show -n acr_name
Also, you can set the subscription in the login time with the parameter --subscription through the CLI command az login.
Reference : az acr - Unable to find repository in case of multiple subscription on single account
Related
I am using the below commands for creating the webapp using Azure CLI but getting the below exception-
Unable to retrieve details of the existing app 'newapp2'. Please check that the app is a part of the current subscription
Command -
az webapp create --name newapp2000 --resource-group staging-grp --plan newappplan2000 --runtime "DOTNETCORE|3.1"
subscription- payasgo
Looking forward for assistance.
A very effective way to check if your commands work or not is going to portal, login with your account, check if your web app exist in your subscription or not.
If you don't want to use portal, you could also use CLI commands. You should check if the session you are using linked to your subscription or not:
az account show --output table
If not, use this command to switch to a different subscription:
az account set --subscription "My Demos"
You could also specify the subscription in the command while creating your web app:
az webapp create --resource-group StorageGroups --subscription "My Demos" \
--name newapp2000 --location eastus --plan newappplan2000 --runtime "DOTNETCORE|3.1"
Update:
A colleague who works for Microsoft said:
Changelog entry for this behaviour change is here: https://github.com/MicrosoftDocs/azure-docs-cli/blob/master/docs-ref-conceptual/release-notes-azure-cli.md#aks-3
I'm following the proper instructions and the documentation must be out of date.
https://learn.microsoft.com/en-us/azure/aks/kubernetes-service-principal
Automatically create and use a service principal.
When you create an AKS cluster in the Azure portal or using the az aks create command, Azure can automatically generate a service principal.
In the following Azure CLI example, a service principal is not specified. In this scenario, the Azure CLI creates a service principal for the AKS cluster. To successfully complete the operation, your Azure account must have the proper rights to create a service principal.
az aks create --name myAKSCluster --resource-group myResourceGroup
This is what happened a few months ago - see Finished service principal creation:
Now when I try I get Add role propagation:
The problem is querying the servicePrincipalProfile.clientId results in msi, I need the guid of the service principal not the Managed Service Identity.
$CLIENT_ID=$(az aks show --resource-group $AKS_RESOURCE_GROUP --name $AKS_CLUSTER_NAME --query "servicePrincipalProfile.clientId" --output tsv)
echo $CLIENT_ID
Used to work:
Now its changed:
How do I create the Kubernetes Cluster with a Service Principal as the documentation states and how it used to work?
Repro steps:
https://github.com/MeaningOfLights/AzureTraining/blob/master/Hands-On-Labs-That-Work/80-Kubernetes.md
https://github.com/MeaningOfLights/AzureTraining/blob/master/Hands-On-Labs-That-Work/85-Kubernetes-Deployment.md
For Reference: I got the same and following your link I found that this worked.
az aks show -g aks -n cluster --query identityProfile.kubeletidentity.clientId -o tsv
and this returned the appropriate guide, that I could use for my RBAC assignment
# get the clientId of the cluster
$clientId = (az aks show -g aks -n cluster --query identityProfile.kubeletidentity.clientId -o tsv)
# get the resourceId of the registry
$acrId=(az acr show -g acr -n myacr --query id -o tsv)
# give authority for cluster id to the acr pull
az role assignment create $clientId --role AcrPull --scope $acrId
We are looking at using az functionapp start --name MyFunctionApp --resource-group MyResourceGroup in Automation Runbook. As part of documentation its clearly stated that Azure CLI commands are supported in Automation runbooks, however not able to see this CLI command.
When trying to use below commands its throwing error that az is not recognized in internal or external command in Automation Runbook test. Can you please suggest sample code and references of modules.
Could not see az functionapp start command in Az help module under Azure RunBook API.
Out task is to start and stop azure functions through Automation Runbooks.
Currently Automation account does not support Azure CLI.
You can check Feedback here-
https://feedback.azure.com/forums/246290-automation/suggestions/31482895-add-support-to-automation-for-az-cli
I've created a bot from the VS Enterprise bot template. When I run the "msbot clone services" command, it hangs in the middle of the script after creating the Azure Search service. There are no apparent errors running --verbose but the script is clearly hung and only installs half of the services in Azure.
Azure shows all the steps so far a successful. Can anyone suggest how to get more logging information than using the --verbose flag?
D:\Dev\sobot181214\sobot181214 msbot clone services --name "sobot181214" --luisAuthoringKey "**REDACTED**" --folder "DeploymentScripts\en" --location "westus" --verbose
Checking az botservice version
az -v
checking dotnet requirement
dotnet --version
Fetching subscription account
az account show
The following services will be created by this operation:
Service Location SKU Resource Group
Azure App Site Plan westus S1 sobot181214
Azure AppInsights Service West US 2 F0 sobot181214
Azure Blob Storage Service westus Standard_LRS sobot181214
Azure Bot Service Registration Global sobot181214
Azure CosmosDB Service westus 1 write region sobot181214
Azure LUIS Cognitive Service westus S0 sobot181214
Azure LUIS Cognitive Service westus S0 sobot181214
(Dispatch)
Azure QnA Maker Service westus S0 sobot181214
Azure Search Service westus Standard sobot181214
Azure WebApp Service (Bot) westus sobot181214
Azure WebApp Service (QnA) westus sobot181214
Resources will be created in subscription: Pay-As-You-Go Dev/Test (**REDACTED**)
Would you like to perform this operation? [y/n]y
Creating Azure group [sobot181214]
az group create -g sobot181214 -l westus --subscription **REDACTED**
Creating Azure Bot Service [sobot181214]
az bot create -g sobot181214 --name sobot181214 --kind webapp --location westus --insights-location "West US 2" --subscription **REDACTED** --version v4 -- lang CSharp --verbose
[az bot] INFO: Microsoft application id not passed as a parameter. Provisioning a new Microsoft application.
(Please be patient, this may take several minutes)
[az bot] To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code xxxxxxx to authenticate.
Fetching bot extended information [sobot181214]
az bot show -g sobot181214 -n sobot181214 --subscription **REDACTED**
Fetching co-created resources [sobot181214]
az resource list -g sobot181214 --subscription **REDACTED**
Fetching bot website appsettings [sobot181214]
az webapp config appsettings list -g sobot181214 -n sobot1812141nay --subscription **REDACTED**
Creating LUIS Cognitive Service [sobot181214-LUIS]
az cognitiveservices account create -g sobot181214 --kind LUIS -n "sobot181214-LUIS" --location westus --sku S0 --yes --subscription **REDACTED**
Fetching LUIS Keys [sobot181214-LUIS]
az cognitiveservices account keys list -g sobot181214 -n "sobot181214-LUIS" --subscription **REDACTED**
Creating site plan [sobot181214]
az appservice plan create -g sobot181214 --sku s1 --name sobot181214 --subscription **REDACTED**
Creating Azure Search Service [sobot181214-search]
az search service create -g sobot181214 -n "sobot181214-search" --location westus --sku standard --subscription **REDACTED**
based on the code snippet and output log that you have provided, I see that it was successfully executing various commands (i.e., creating group, creating bot, showing bot, listing resource, listing webapp config appsettings, creating cognitiveservices account, listing cognitiveservices account keys, creating appservice plan respectively) until it has reached the step to create search service. But I think there was some issue while creation of appservice plan step or even while creation of bot step. So just to understand the issue better, by chance if you have appservice plan named ‘sobot181214’ still available and bot webapp named ‘sobot181214’ still available then can you check if they are properly created or are they in a kind of corrupted or unstable state ?
Also the catch point is as per this (https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-enterprise-template-deployment?view=azure-bot-service-4.0) link, it states that some users might experience issues if ‘--appId’ argument is not provided while running the command ‘msbot clone services’. So can you browse to https://apps.dev.microsoft.com and manually create a new application retrieving the ApplicationID and Password/Secret. And then run the ‘msbot clone services’ command along with the arguments ‘--appId’ and --appSecret’ passing the values you have just retrieved and let me know the outcome. Also ensure that you wrap the secret with quotes to prevent parsing issues, e.g: --appSecret "YOUR_SECRET".
On the other hand, if you are interested to debug the current issue in detail, you may try to update all the ‘az’ commands in the script ‘C:\Users\USERNAME\AppData\Roaming\npm\node_modules\msbot\bin\msbot-clone-services.js’ appended at the end with ‘ --debug’ parameter which would increase the logging verbosity to show all debug logs while executing ‘msbot clone services’ command. But in some cases, updating ‘msbot-clone-services.js’ file corrupts the msbot related packages. In case if that happens then you may uninstall and re-install msbot and related packages by running the command ‘npm install -g ludown luis-apis qnamaker botdispatch msbot chatdown’ as instructed in this (https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-enterprise-template-deployment?view=azure-bot-service-4.0) link.
Hope this helps!!
Using powershell how do we login to Azure Container registry. The sample provided is only for is only for Azure CLI
az acr login --name <acrName>
Connect-AzContainerRegistry -Name MyContainerRegistry
Microsoft Docs
Available as part of the official Az Powershell module. Note that the older AzureRM module does not include this functionality.
There is no single powershell to login in Azure Container registry, if you want use powershell to login in, we should get the admin credentials for the registry first and run docker login to log in.
You could refer to the command below.
$creds = Get-AzureRmContainerRegistryCredential -Registry $registry
$creds.Password | docker login $registry.LoginServer -u $creds.Username --password-stdin
For more details, refer to this article.