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.
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.
I want to get the list of users who has access of Azure DevOps Repo using PowerShell script or azure CLI.
az devops user list = use this command to list all users on Azure DevOps organization.
az devops user list
[--detect {false, true}]
[--org]
[--skip]
[--top]$allUsers = az devops user list --org $Organization | ConvertFrom-Jsonforeach($au in $allUsers.members)
{
Write-Host $au.user.principalName
}
We have the Azure Pipelines PowerShell Module to create a report of listing the users/groups having permissions to the repositories as given detailed in this SO Thread .
References:
https://vinijmoura.medium.com/how-to-list-all-users-and-group-permissions-on-azure-devops-using-azure-devops-cli-54f73a20a4c7
I Have an Azure Release Pipeline for my website. For one of the task in that Release Pipeline, i need to disable HTTPS ONLY option (its is available under SSL/TLS Blade in Azure Portal check below image). After that task is executed i want to turn ON that "HTTPS ONLY" again.
Is there a simple way simple way to do that?
PS: i have reviewed this question
already but i don't want to use ARM Template
You may use Azure CLI and Azure CLI task to achieve this. Here is the command:
az webapp update --resource-group <YourResourceGroupName> --name <YourWebAppName> --set HttpsOnly=true
I have Azure Pipeline setup with Azure CLI task
I am using Service Connection. In az cli task I want to retrieve current Service Connection details (like appId name objectId etc..) which I am using to run this task.
az ad sp show required id parameter, which will not work in my case. I want to know that id dynamically
Is there any way to get current SP details?
You can now use a checkbox to expose the service principal id, secret and tenant in the Azure CLI script.
You can get your current session context with
az account show
and then simply get some extra details on the service principal
az ad sp show --id <guid>
and application
az ad app show --id <guid>
I found Service principle is in Azure Active Directory. And i cannot add them to azure devops service connection. What i can add is Azure subscription or azure resource group.
Not sure show how did you add your applications to azure service connection.
If you want to get the connection details. You can try az accout show for azure subscription, or az group show --name for azure resource group
Ran into this same issue, and found out the simplest possible way to get the SP Id in Azure Cli task in the pipeline:
First, define in the task addSpnToEnvironment like this:
- task: AzureCLI#2
continueOnError: true
inputs:
addSpnToEnvironment: true
scriptLocation: inlineScript
After that, you can get the SP Id from $env:servicePrincipalId and use it like this:
az deployment group create ... --parameters SPId=$env:servicePrincipalId
Combine with Adam Marczak's solution with python in one liner,
az ad sp show --id $(az account show| python -c 'import json,sys;print json.load(sys.stdin)["user"]["name"]')
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