Office
33 TopicsPart 8 - Manage Azure and Microsoft 365 with the Microsoft Graph PowerShell SDK!
Dear Microsoft Azure and Microsoft 365 Friends, This article continues with the topic Microsoft Graph PowerShell SDK. Part 1 to 7 can be found here: https://techcommunity.microsoft.com/t5/windows-powershell/part-1-manage-azure-and-microsoft-365-with-the-microsoft-graph/m-p/3300352 https://techcommunity.microsoft.com/t5/windows-powershell/part-2-manage-azure-and-microsoft-365-with-the-microsoft-graph/m-p/3302366 https://techcommunity.microsoft.com/t5/windows-powershell/part-3-manage-azure-and-microsoft-365-with-the-microsoft-graph/m-p/3339696 https://techcommunity.microsoft.com/t5/windows-powershell/part-4-manage-azure-and-microsoft-365-with-the-microsoft-graph/m-p/3409310 https://techcommunity.microsoft.com/t5/windows-powershell/part-5-manage-azure-and-microsoft-365-with-the-microsoft-graph/m-p/3442453 https://techcommunity.microsoft.com/t5/windows-powershell/part-6-manage-azure-and-microsoft-365-with-the-microsoft-graph/m-p/3923379 https://techcommunity.microsoft.com/t5/windows-powershell/part-7-manage-azure-and-microsoft-365-with-the-microsoft-graph/td-p/3924070 This article is now about doing some tasks with the Microsoft Graph. We work in Microsoft Teams, create a new team, channel, and add a member as an owner. Create a new Team: #Core Connection for Managing Teams $scopes = @( "Team.Create" "TeamSettings.ReadWrite.All" "TeamsTab.ReadWrite.All" "TeamsTab.Create" "TeamMember.ReadWrite.All" "Group.ReadWrite.All" "GroupMember.ReadWrite.All" ) Connect-MgGraph -Scopes $scopes #Retrieve Microsoft 365 Group and Team $group = Get-MgGroup -Filter "DisplayName eq 'Cardano'" Get-MgTeam -TeamId $group.Id #Create a New Team New-MgTeam -AdditionalProperties @{ "email address removed for privacy reasons" = "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"; "displayName" = "Ethereum"; "description" = "Ethereum Team"; } #List the new Microsoft Team $group = Get-MgGroup -Filter "DisplayName eq 'Ethereum'" Get-MgTeam -TeamId $group.Id Create a new Channel in the new Team: #Create a Team Channel $group = Get-MgGroup -Filter "DisplayName eq 'Ethereum'" $team = Get-MgTeam -TeamId $group.Id $channelname = "Traders" $channeldescription = "Ethereum Traders" $channel = New-MgTeamChannel -TeamId $team.Id -DisplayName $channelname -Description $channeldescription #List the new Team Channel Get-MgTeamChannel -TeamId $team.Id -ChannelId $channel.Id Add a member to the new team as an owner: #Retrieve User Details $email = "email address removed for privacy reasons" $user = Get-MgUser -UserId $email #Retrieve Team and Add an Owner $group = Get-MgGroup -Filter "DisplayName eq 'Ethereum'" $team = Get-MgTeam -TeamId $group.Id $ownerproperties = @{ "@odata.type" = "#microsoft.graph.aadUserConversationMember"; "email address removed for privacy reasons" = "https://graph.microsoft.com/beta/users/" + $user.Id } $role = "owner" New-MgTeamMember -TeamId $team.Id -Roles $role -AdditionalProperties $ownerproperties #Retrieve Team Member and Owner for the Team Get-MgTeamMember -TeamId $team.Id | Select-Object -Property Roles,DisplayName Update some properties: #Lets update some properties $params = @{ MemberSettings = @{ AllowCreateUpdateChannels = "true" #<TrueOrFalse> } MessagingSettings = @{ AllowUserEditMessages = "true" #<TrueOrFalse> AllowUserDeleteMessages = "false" #<TrueOrFalse> } FunSettings = @{ AllowGiphy = "true" #<TrueOrFalse> GiphyContentRating = "moderate" #<ModerateOrStrict> } } Update-MgTeam -TeamId 97d4ea74-1b57-4457-b172-182d7a5d5aa5 -BodyParameter $params So that's it again for part 8, we'll see you again in the next part! A little preview, in the next part we'll Converting Existing PowerShell Scripts. See you soon. I hope this article was useful. Thank you for taking the time to read the article. Best regards, Tom Wechsler P.S. All scripts (#PowerShell, Azure CLI, #Terraform, #ARM) that I use can be found on GitHub! https://github.com/tomwechsler1.2KViews1like0CommentsUsing a Script to Data to Others
Hello guys Well, first of all, I apologize in advance as I still use an online translator to be able to communicate. That said, here's my question: I have a Script - nothing too complex, I'm still a beginner - that is getting a little big, with many lines. I thought about splitting them into parts, which would make it easier for me to manage. I had seen a way to write, for example, a Script that could collect information whenever another was invoked. Something similar to this example: Script 01: file1.ps1 $NPC = $Env:COMPUTERNAME $DATE = date Script 02: file2.ps1 .\file1.ps1 Write-Host "the pc name is" $NPC ... Script 03: file3.ps1 .\file1.ps1 Write-Host "Today is" $DATA... In theory this should work. Via ISE works. But not in practice. I really don't know where my fault would be and if this is really possible. Can you help me? Clarify and better understand this issue? Thanks a lot for the help everyone! And good week!Solved1.3KViews1like3Comments