Im trying to deploy a Runbook that executes some cmdlets from ACR. For example: az acr repository list
Which module do I have to import?
Any ideas?
Azure runbook does not support the type of Azure CLI currently.
Reference - https://learn.microsoft.com/en-us/azure/automation/automation-runbook-types
The customer feedback and the response of the Automation Team.
https://feedback.azure.com/forums/246290-automation/suggestions/32547325-az-cli-support-in-runbooks
Related
my scenario is like I have shared container registry in one subscription say subscription A, I need to pull image from ACR to ACA through DevOps pipelines. The ACAs are present for each environment like dev, test, UAT & etc which is in another subscription say subscription B. I am using 'az containerapp up' command in azure devops pipelines to pull image of the shared ACR. Getting error 'The resource is not found in the subscription B'. What might be the alternative possible solution because we need to reduce cost of using container registry for each environment.
I am using service connections to pull image and the service connections are separate for separate subscriptions.
I know that they are in different subscriptions but I searched on websites to connect two different subscriptions.
Is there a possibility that I can connect two different service connections in azure devops & use one service connection to pull that image.
Before integrating the Azure CLI command az containerapp up with Azure pipelines, please first confirm you are able to pull the ACR image from Sub B to deploy the container app in Sub A via CloudShell or LocalPowerShell.
I tested to create ARM service connection with Tenant Root Management Group whose referenced service principle had access to both subscriptions; the issue still existed.
In local PowerShell, I az login with my user account and still could reproduce the issue.
az containerapp up `
--name XXcontainerapp `
--image XXacrsubB.azurecr.io/azurecontainerappdemo:XX `
--resource-group rg-containerapp `
--environment TestEnv `
--registry-username XXacrsubB `
--registry-password XXXXXX
It seemed to be a limitation with this command az containerapp up. You may consider reporting the issue with Azure CLI.
Now i want to import Python packages by ARM template.
Please help me
enter image description here
You can reference this document to set up an ARM template to deploy your Azure Automation account.
After setting up the ARM template:
On your local machine, you can execute the related Azure CLI or Azure PowerShell commands to run the ARM template deployment.
In the Azure Pipelines on Azure DevOps, you can use the ARM Template Deployment Task to run the deployment.
For automation download and add python package in Azure Automation Account:
Step 1: You have to create Azure Run As Account.
Step 2: Create Runbook and you can import a Python 3 package and its dependencies by importing the following Python script into a Python 3 runbook, and then running it
Step 3: Start runbook
You have to add following argument for runbook:
subscription_id (-s) - Subscription id of the Automation account
resource_group (-g) - Resource group name of the Automation account
automation_account (-a) - Automation account name
module_name (-m) - Name of module to import from pypi.org
More information: Manage python2, Manage python3
I want to create a new Azure DevOps organization with the az command line.
I have installed the devops extension.
I have read the Microsoft documentation and it describes how to create an organization through web interface, but there is nothing described for command line.
I have also read the documentation of az and az devops extension.
Have I missed something?
I am afraid currently it is not supported to create Azure DevOps organization via az devops command line or the DevOps REST API.
However, you can use Azure CLI az resource create to create a resource of type microsoft.visualstudio/account as a workaround. This will create an Azure DevOps organization. For example:
az resource create -g AzureResourceGroup -n MyDevopsOrganizationName `
--resource-type microsoft.visualstudio/account --is-full-object `
--properties '{\"location\":\"Central Us\", \"properties\":{ \"operationType\": \"Create\"}}'
The command above creates Azure DevOps organization MyDevopsOrganizationName.
https://MyDevopsOrganizationName.visualstudio.com
You can also use an ARM template to create an Azure DevOps organization.
I have created a Build Docker Image task inside DevOps Build Pipeline.
In this task, after selecting the Azure Subscription, the Azure container registry list shows No results Found message.
Although I have created the ACR in that subscription, I'm unable to connect to it via DevOps Build Pipeline.
Is this issue related to permissions or any other?
Did you create a Service Principal for Azure DevOps pipeline? Once created you can give it the proper role for what you are trying to do.
# Assign the desired role to the service principal. Modify the '--role' argument
# value as desired:
# acrpull: pull only
# acrpush: push and pull
# owner: push, pull, and assign roles
az role assignment create --assignee $SERVICE_PRINCIPAL_ID --scope $ACR_REGISTRY_ID --role acrpull
In your build pipeline, you need to add a login task that uses an existing Service Connection before your Docker build and/or push task. The Service Connection has the subscription and the name of the Azure Container Registry where you will be uploading your Docker images.
Is it possible to export the JSON definition for an existing app service in Azure?
Ie this json object: https://learn.microsoft.com/en-us/azure/templates/microsoft.web/sites
The app service was created using the Azure Portal UI and I want to recreate it using the Azure CLI command line.
You could use az group export --name *** >test.json to capture a resource group as a template. Please refer to this link.
But currently resource type Microsoft.Web/sites does not support export, please refer to this feedback.
Note: If also could find the error log on Azure Portal.