Showing posts with label powershell. Show all posts
Showing posts with label powershell. Show all posts

Thursday, September 26, 2024

Quick tip: Get-AzSubscription and Azure Cloud Shell

The Get-AzSubscription PowerShell cmdlet gets the subscription ID, subscription name and home tenant for subscriptions that the current account can access. You can also pass this values in as a parameter e.g. "Get-AzSubscription -SubscriptionId" to find the name of a subscription. 

The easiest way to execute this cmdlet (without having to install anything on your machine) is by using Azure Cloud Shell.  A handy feature of Azure Cloud Shell is predictive intellisense - use the RightArrow key to accept an inline suggestion.



Sunday, March 22, 2020

Generating Azure Application Insight Key in Azure DevOps pipeline

If you want to generate an Application Insights key in your Azure DevOps pipeline - you can use the the PowerShell code snippet below in a Azure PowerShell task.


Look at Automate Azure Application Insight resources using PowerShell and New-AzureRmApplicationInsightsKeyApiKey for more details.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Install-Module AzureRM.ApplicationInsights -force -verbose -scope CurrentUser
Import-Module AzureRM.ApplicationInsights

$resourcegroupname ='rg_func****'
$aicomponentname ='func****'
$permissions = @("ReadTelemetry", "WriteAnnotations")
$apikeydescription = 'testapikey'

New-AzureRmApplicationInsightsApiKey -ResourceGroupName $resourcegroupname 
-Name $aicomponentname -Description $apikeydescription -Permissions $permissions

Monday, January 08, 2018

Quick tip: finding all users with Dynamics 365 Service Administrator role in Office 365 tenant with PowerShell

Unfortunately the Office 365 Admin Portal, does not contain a predefined view to show all users who have the Dynamics 365 Service Administrator role – this role allows you to manage Dynamics 365 at tenant level (See Use the service admin role to manage your tenant for more details). But luckily you can also retrieve this information using PowerShell.

First make sure that you install the different prerequisites as outlined in Connect to Office 365 PowerShell – next open Windows Azure Active Directory Module for Windows PowerShell. To connect to Office 365, simply type connect-msolservice . Get-MsolRole will give you a list of all administrator roles. You will see that the internal role name which is listed is still "CRM Service Administrator". The last line will export all users with this role to a CSV file

 connect-msolservice  
 get-msolrole | select name, description  
 $role = get-msolrole -rolename "CRM Service Administrator"  
 get-msolrolemember -roleobjectid $role.objectid | export-csv d:\temp\serviceadmins.csv  

Thursday, June 14, 2012

SharePoint 2010 Online Powershell Commandbuilder

Something interesting for people who want to start using Powershell and SharePoint 2010 - the Online PowerShell Command Builder Tool. The Windows PowerShell Command Builder for SharePoint 2010 (Microsoft Office 365) is a Silverlight 4 application that is designed to help IT professionals and power users learn how to use Windows PowerShell for administrative tasks. You can also install it locally: http://www.microsoft.com/resources/TechNet/en-us/Office/media/WindowsPowerShell/WindowsPowerShellCommandBuilder.html