Example, I want to Offboard Tiger from Azure Develops Organization BigZoo (Tiger has 3 Azure organization, BigZoo, SmallZoo, middleZoo--I only want to remove tiger from BigZoo)
Use this Azure CLI in the Azure Cloudshell Powershell will be working
az devops user remove --user tiger
[--org BigZoo]
[--yes]
But it does not work in Azure function-->Azure function use PowerShell environment--> CloudPowerShell can read AzureCLi but Powershell In AzureFunction cannot read anything related with Az
So, if I only want use powershell without any help from Azure CLI, there are some module but all imported module is remove user from all Organizations--> Not remove user from specific organization
Any suggestion? Remove user from specific AzureDevops Organization. Using API seems too complex . Any good idea?
Thanks
I've not tried this but there is the VSTeam powershell module in the PowerShell gallery which wraps the Azure Devops API.
This has a function called: Remove-VSTeamUserEntitlement
Docs here:
https://methodsandpractices.github.io/vsteam-docs/docs/modules/vsteam/commands/Remove-VSTeamUserEntitlement
Module here:
https://www.powershellgallery.com/packages/VSTeam/
Add the module to the Requirements.psd1 file of your azure functions project and you should be able to utilise it.
Related
I need to automate pg_dump for a postress server in Azure. I preferably want to use github actions and azure powershell to do this and store the file on an azure storage account
I cant seem to find any docs online which documents the use of github actions and azure powershell to do this and save the exported postgress file to an azure storage account
I need to write PowerShell script for AzureDevOps pipeline which will export solution from Dynamics organization (online version). Also it's important to use 'Service Principal/client secret (supports MFA)' auth type.
I have found some examples, https://d365dotblog.com/2020/05/04/powershell-scripts-to-export-and-import-the-dynamics-365-ce-solution/ - it is one of them, but it doesnt work inside pipeline and has another type of auth.
I am newbie in PowerShell and dont know how to write script by myself. Also I haven't found info about my question in the internet. Can you give me example?
I am fairly new to Azure Devops and Azure Databricks.
I have created Azure Databricks workspace using Azure Devops CI/CD Pipeline.
Now I am looking for a solution to Add Users to Azure Databricks workspace using DevOps Pipeline.
There are several methods:
Use databricks_user resource from Databricks Terraform provider - it could be as simple as example below, or you can combine it with azuread provider, and pull users from Azure Active Directory. Another advantage of Terraform provider is that you can combine it with user groups, and other things.
resource "databricks_user" "me" {
user_name = "me#example.com"
}
Use Databricks SCIM API for Users (part of general SCIM API) - creation is quite straightforward, you just need to form correct JSON as described in docs (I didn't want to copy JSON from there), and do a call with curl or something like that. Also,
There is a collection of PowerShell scripts developed by the DataThirst company, that include scripts for adding & removing users, etc. These scripts are using REST API under the hood, and could be simpler than to use REST API. Some of these tasks are also available on the DevOps marketplace.
In any case, you need to authenticate to the workspace. For automated pipelines you have two choices - service principals or managed identity associated with DevOps worker, and they should have Owner or Contributor permissions on the workspace level, or be added into workspace as admin users.
For REST API authentication of service principal is described in details in documentation, for managed identity you just get the token from internal REST API.
Databricks Terraform provider also supports both service principals and managed identity.
How can I get a list of all the Active Directories in Azure using powershell? To be more precise, I am looking for the following information which is available in the Azure Portal [The following two entries] :
Also, how can I get detailed information of each of those two directories in powershell?
(I have already installed the Azure Active Directory Cmdlets)
Both options below will retrieve the available tenants, however the Azure AD Cmdlet will provide a little more information such as the Display Name and Verified Domains of the tenants.
Azure AD Modules
Cmdlet: Get-AzureADTenantDetail -All $true
Documentation: https://learn.microsoft.com/en-us/powershell/module/azuread/get-azureadtenantdetail
Azure Rm Modules
Cmdlet:Get-AzureRmTenant
Documentation: https://learn.microsoft.com/en-us/powershell/module/azurerm.profile/get-azurermtenant
Testing:
If you want to try these Cmdlets without needing to install them locally, check out Azure Cloud Shell. It'll provide you with a browser based Command Line for Microsoft Azure.
https://shell.azure.com
https://azure.microsoft.com/en-us/features/cloud-shell/
I know how to add a co-administrator via the portal, but need a way to add it via PowerShell.
I need this method as I have lost access to the login id, but have the publish setting file so can administrator my virtual machines.
Unfortunately you can't. Azure PowerShell Cmdlets are essentially wrapper over Azure Service Management API and currently the API does not expose any method to add co-admins programmatically.
Azure have rolled out Roll Based Access Control which will allow you to automate the adding of new admins to your Azure Subscription. Intro here: https://azure.microsoft.com/en-us/documentation/articles/role-based-access-control-configure/
You would add a new user as an Owner at the Subscription scope. These operations are available using both PowerShell and REST