you can do something like this -
----------
Get-AzDataFactory -Name $ADFName -ResourceGroupName $resourceGroupName -ErrorVariable notPresent -ErrorAction SilentlyContinue
if ($notPresent)
{
# ADF doesn't exist
Write-Output "ADF doesnt exists attempting to create " | timestamp
New-AzDataFactory -Name $ADFName -ResourceGroupName $resourceGroupName -Location $location -Tags $Tags
Write-Output "Resource Group created " | timestamp
#New-AzDataFactoryLinkedService https://learn.microsoft.com/en-us/powershell/module/az.datafactory/new-azdatafactorylinkedservice?view=azps-7.3.2
#New-AzDataFactoryDataset https://learn.microsoft.com/en-us/powershell/module/az.datafactory/new-azdatafactorydataset?view=azps-7.3.2
#New-AzDataFactoryPipeline https://learn.microsoft.com/en-us/powershell/module/az.datafactory/new-azdatafactorypipeline?view=azps-7.3.2
#etc.
}
else
{
# ADF exist
Write-Output "ADF exists ready to deploy to" | timestamp
#New-AzDataFactoryLinkedService https://learn.microsoft.com/en-us/powershell/module/az.datafactory/new-azdatafactorylinkedservice?view=azps-7.3.2
#New-AzDataFactoryDataset https://learn.microsoft.com/en-us/powershell/module/az.datafactory/new-azdatafactorydataset?view=azps-7.3.2
#New-AzDataFactoryPipeline https://learn.microsoft.com/en-us/powershell/module/az.datafactory/new-azdatafactorypipeline?view=azps-7.3.2
#etc.
}
----------
there is a ton of documentation on these PS modules
https://learn.microsoft.com/en-us/powershell/module/az.datafactory/?view=azps-7.3.2#data-factories