-
KQL To List DCRs To Log Analytics Workspace
Resources | where type == “microsoft.insights/datacollectionrules” | join kind=inner ( resourcecontainers | where type == “microsoft.resources/subscriptions” | project subscriptionId, SubscriptionName = name ) on subscriptionId | extend laDestinations = properties.destinations.logAnalytics | mv-expand laDestinations | extend WorkspaceResourceId = tostring(laDestinations.workspaceResourceId) | extend WorkspaceName = split(WorkspaceResourceId, “/”)[-1] | extend TargetResourcesRaw = properties.targetResources | mv-expand TargetResourcesRaw to typeof(string) | extend ConnectedResourceName = split(TargetResourcesRaw, “/”)[-1] | project DCRName = name, SubscriptionName, WorkspaceName, SubscriptionId, ResourceGroup = resourceGroup, Location = location, DataSources = properties.dataSources, ConnectedResourceName
-
Steps To Get Az Activity Across All Subscriptions
# Login to Azure Connect-AzAccount # Define time range $startTime = (Get-Date).AddDays(-10) # Initialize array to collect results $allLogs = @() # Get all subscriptions $subscriptions = Get-AzSubscription foreach ($sub in $subscriptions) { $subscriptionId = $sub.Id $subscriptionName = $sub.Name Select-AzSubscription -SubscriptionId $subscriptionId # Get all role assignments at subscription scope …
-
Steps To Get All AZ Roles in All Subcriptions
Connect-AzAccount # Prepare results array and output path $results = @() $outputFile = “C:\Temp\AzureRoleAssignments_Combined.csv” if (Test-Path $outputFile) { Remove-Item $outputFile } # Loop through subscriptions $subscriptions = Get-AzSubscription foreach ($subscription in $subscriptions) { Write-Host “Processing subscription: $($subscription.Name)” Set-AzContext -SubscriptionId $subscription.Id # — Permanent Assignments — $permanentAssignments = Get-AzRoleAssignment foreach ($assignment…
-
KQL To Pull LogType, Resourcename, LogsVolume From LogAnalytics Workspace
union withsource=LogTable *| where TimeGenerated > ago(60d)| extend ResourceId = tostring(parse_json(tostring(_ResourceId)))| extend ResourceName = tostring(split(ResourceId, “/”)[8])| extend ResourceType = case(LogTable in (“Heartbeat”, “Perf”, “InsightsMetrics”, “Syslog”, “SecurityEvent”, “VMConnection”, “Update”), “Virtual Machine”,LogTable startswith “App”, “Application”,LogTable in (“CommonSecurityLog”, “AzureDiagnostics”), “Firewall”,“Other”)| summarizeLogCount = count(),IngestedVolumeMB = sum(_BilledSize) / 1024.0,TotalBilledVolumeMB = sum(_BilledSize) / 1024.0 // Same as IngestedVolumeMB unless raw size…
-
GET EXO MAILBOX PERMISSION For All users
Access rights showed as System.Collections.ArrayList in csv. you have to use use ‘-join’ for the array. Get-exoMailbox -ResultSize unlimited | Get-EXOMailboxPermission | Select Identity, User, Deny,@{n=’AccessRights’;e={$_.AccessRights -join “;”}}, IsInherited| Where {($_.user -ne “NT AUTHORITY\SELF”)}| Export-Csv “filpath\filename$(Get-Date -Format ‘dd_MM_yyyy HH_mm tt’).csv” -NoTypeInformation using filter Get-exoMailbox -ResultSize unlimited -Properties identity,RecipientTypeDetails,mailboxplan | Where-Object {($_.MailboxPlan -like “ExchangeOnlineEnterprise-*“) } |…
-
Get Members From Dynamic DLs in Office365
$FTE = Get-DynamicDistributionGroup “Branding Campaign Team”; Get-Recipient -RecipientPreviewFilter $FTE.RecipientFilter | Export -CSV “D:\DGList.csv” $FTE = Get-DynamicDistributionGroup “Branding Campaign Team”; Get-Recipient -RecipientPreviewFilter $FTE.RecipientFilter | Select Displayname
-
Add Message Options to Outlook Quick Access Toolbar
no need to double click on email properties for message headers Outlook 365 –> options –> Quick Access Toolbar item –> select choose All Commands in “choose commands from” under customize toolbar –> select message options –> add –> OK
-
Report on Recoverable Items
$users = Get-Mailbox -ResultSize Unlimited -Filter {LitigationHoldEnabled -eq $true} $colusers=@() [string]$LogFile = “Path\filename-$(Get-Date -Format ‘dd_MM_yyyy HH_mm tt’).csv” # Path of the Log File Add-Content $LogFile (“Mailbox” + “;” +” Item Count”); $users | ForEach-Object { Start-Sleep -Milliseconds 1000 $Identity = $_.WindowsEmailAddress Write-host “working on:” $Identity $colUsers = (Get-MailboxFolderStatistics -Identity $identity | where {$_.name -eq ‘Recoverable…
-
Add External domains to the existing Allowed Domains For Teams
Add domains to the existing Allowed Domains First, a List is created and domains are added to it, then use the Add method in the AllowedDomainsAsAList parameter to add the domains to the existing allowed domains list. When this command completes, the domains in the list will be added to any domains already on the…