@Christopher Jack To connect to Azure Blob with PowerShell unattended using MFA, you will need to use the 'Connect-AzAccount' command with the '-ServicePrincipal' and '-Tenant' parameters, as well as the '-UseDeviceAuthentication' parameter. The '-UseDeviceAuthentication' parameter allows you to authenticate with MFA using a device that has been registered with Azure Active Directory.
You will also need to create a service principal in Azure Active Directory and assign it the appropriate permissions to access the blob storage. Once you have the service principal's client ID and client secret, you can use them to authenticate with the 'Connect-AzAccount' command.
Here is an example of how to connect to Azure Blob with PowerShell unattended using MFA:
$clientId = "your-client-id"
$clientSecret = "your-client-secret"
$tenantId = "your-tenant-id"
Connect-AzAccount -ServicePrincipal -Tenant $tenantId -ApplicationId $clientId -Password $clientSecret -UseDeviceAuthentication
You will be prompted to enter the verification code that is sent to your registered device. Once you have entered the code, you will be authenticated and able to access the blob storage.
Please note that you will need to have the Azure MFA app installed on your device and have registered it with Azure Active Directory.
Hope this helps. Please let us know if you have any more questions and we will be glad to assist you further. Thank you!
Remember:
Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
Want a reminder to come back and check responses? Here is how to subscribe to a notification.