Azure
Learn how to Create a Crew in Microsoft Groups Utilizing Powershell in Azure Automation
Introduction
Azure Automation supplies a cloud-based automation and configuration service that gives constant administration throughout your Azure and non-Azure environments. Azure Automation helps to automate frequent, time-consuming, and error-prone cloud administration duties. It consists of course of automation, replace administration, and configuration options.
Use case/Enterprise State of affairs
Within the case that we have to prohibit the customers by creating groups on their very own and must arrange some provisioning course of round this, then we have to go together with both PowerShell or Graph API. We’d must schedule this as a job that may get all of the requests (new Crew requests) raised by the customers and provision the groups accordingly after some approval course of. For this, we are able to use Azure Automation to schedule the job which executes the PowerShell script periodically to provision the groups.
On this article, you will notice methods to carry out the next duties:
- Create an Automation Account
- Create Credential Asset – To retailer the credentials which will likely be utilized by PowerShell for authentication.
- Import PowerShell Module – Import Microsoft Groups PowerShell Cmdlets module with the intention to entry Groups Cmdlets.
- Create PowerShell runbook – Script to create a brand new crew
- Take a look at and publish the runbook
Create an Automation Account
- Navigate to the Azure portal.
- Click on on Create a Useful resource.
- Seek for Automation and choose Automation. Click on Create.
- Enter all of the required particulars and click on Create.
- As soon as it’s deployed efficiently, navigate to the useful resource.
- Check with this hyperlink to know extra in regards to the Automation account.
Create credential asset
- Navigate to Automation account created within the earlier step.
- Beneath Shared Sources, click on Credentials.
- Click on Add a credential.
- Enter all of the required particulars and click on Create.
- Credential property created efficiently. Copy the identify in a notepad which will likely be used within the PowerShell to get the credentials.
Import PowerShell Modules
With a purpose to create a crew in Microsoft Groups utilizing PowerShell, we have to set up the Microsoft Groups Cmdlets module. Azure Automation supplies the power to import PowerShell modules into your Automation Account for use by the PowerShell based mostly runbooks.
- Navigate to Automation account.
- Beneath Shared Sources, click on Modules.
- Click on Browse Gallery. Seek for Groups and choose MicrosoftTeams
- Click on Import to import the Groups PowerShell Module.
- It would take a couple of minutes to import the module.
- As soon as the module is imported efficiently, all of the accessible cmdlets will likely be displayed.
Create PowerShell runbook
Azure Automation helps a number of kinds of runbooks. We’re going to see how we are able to create the PowerShell runbook with the intention to provision a crew in Microsoft Groups.
- Navigate to Automation account.
- Beneath Course of Automation, click on Runbooks.
- Click on Create a runbook.
- Enter the required particulars
- Within the Edit pane, copy and paste the beneath script.
- # Get the credential from Automation
- $credential = Get-AutomationPSCredential -Identify ‘TeamsAdminCredential’
- $userName = $credential.UserName
- $securePassword = $credential.Password
- $psCredential = New-Object –TypeName System.Administration.Automation.PSCredential –ArgumentList $userName, $securePassword
- # Join to Microsoft Groups
- Join-MicrosoftTeams -Credential $psCredential
- # Create a new Crew
- New-Crew -DisplayName “Demo Crew – AZ Automation”
- # Disconnect from Microsoft Groups
- Disconnect-MicrosoftTeams
- Click on Save.
Take a look at and publish the runbook
- Navigate to Automation account.
- Beneath Course of Automation, click on Runbooks.
- Click on the newly created runbook (named as CreateTeam).
- Click on Edit.
- Click on Take a look at pane to check the runbook.
- Click on Begin.
- Script ran efficiently, as proven beneath.
- The crew was created efficiently, as proven beneath.
- Shut this window by clicking the shut (X) icon on the prime proper nook of the web page.
- Publish the runbook.
- Runbook efficiently printed, as proven beneath.
- Based mostly on the necessities, this PowerShell runbook might be scheduled by clicking Hyperlink to Schedule.
Abstract
Thus, on this weblog, you noticed methods to create a crew in Microsoft Groups utilizing PowerShell in Azure Automation.