Scripts/Remove-NFSv3ExtendedGroups.ps1

<#
    .SYNOPSIS
    Removes NFSv3 extended groups stored in Azure DB for specific Uid.
 
    .DESCRIPTION
    This command removes NFSv3 extended groups stored in Azure DB for specific Uid.
 
    .PARAMETER ResourceGroupName
    The name of the Resource Group in Azure where the storage account resides.
 
    .PARAMETER StorageAccountName
    The name of the Azure storage account.
 
    .PARAMETER Uid
    Uid of user whose supplementary groups needs to be deleted.
 
    .EXAMPLE
    Remove-NFSv3ExtendedGroups -ResourceGroupName "MyRG" -StorageAccountName "MyStorage" -Uid "1001"
 
    .NOTES
    Written by: [Azure Blob NFS]
    Date: [October 10, 2024]
#>

function Remove-NFSv3ExtendedGroups{
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$true)]
        [string]$ResourceGroupName,

        [Parameter(Mandatory=$true)]
        [string]$StorageAccountName,

        [Parameter(Mandatory=$true)]
        [string]$Uid
    )

    $prefix = "nfsv3_"
    $userName = $prefix + $Uid

    # Remove localuser from storage server.
    Remove-AzStorageLocalUser -ResourceGroupName $ResourceGroupName -StorageAccountName $StorageAccountName -UserName $userName
}