Compilation of a mixture of professional and recreational projects in the space of IT, Software Development, DevOps, and Infosec
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "4.11.0"
}
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 3.0"
}
}
backend "s3" {
bucket = "samroyio-website-backend"
region = "us-east-1"
key = "terraform.tfstate"
}
}
provider "aws" {
region = "us-east-1"
}
using namespace System.Net
using namespace System.Web
param($req, $TriggerMetadata)
$ErrorActionPreference = 'Stop'
# Load request body
$requestBody = Get-Content $req -Raw | ConvertFrom-Json
$userId = $requestBody.userId
# Set your PowerShell credentials for Exchange Online
$Username = $env:EXCHANGE_USERNAME
$Password = $env:EXCHANGE_PASSWORD | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($Username, $Password)
try {
# Import Exchange Online Management module
Import-Module ExchangeOnlineManagement -ErrorAction Stop
# Connect to Exchange Online
Connect-ExchangeOnline -Credential $credential -ErrorAction Stop
# Convert user mailbox to shared mailbox
Set-Mailbox -Identity $userId -Type Shared -ErrorAction Stop
# Disconnect from Exchange Online
Disconnect-ExchangeOnline -Confirm:$false -ErrorAction Stop
# Return success response
$response = @{
StatusCode = 200
Body = "User account successfully converted to shared mailbox."
}
} catch {
# Return error response
$response = @{
StatusCode = 500
Body = "An error occurred: $($_.Exception.Message)"
}
}
Push-OutputBinding -Name res -Value ([HttpResponseContext]$response)
const Layout = ({ children }: Props) => (
<StaticQuery
query={graphql`
query SiteTitleQuery {
site {
siteMetadata {
title
}
}
}
`}
render={(data) => (
<>
<Helmet
title={data.site.siteMetadata.title}
meta={[
{ name: 'description', content: 'Sample' },
{ name: 'keywords', content: 'sample, something' },
]}
>
<html lang="en" />
</Helmet>
<Header siteTitle={data.site.siteMetadata.title} />
<Container style={{}}>{children}</Container>
</>
)}
/>
)