Hi @sakuraime , welcome to Microsoft Q&A forum.
Client secret cannot be retrieved once after we set it. So it has be to either hard-coded in the script or store it somewhere else from where we can read it. One way is to store it in a keyvault and use it as and when needed.
Please refer to below article which explains how can we store and retrieve it. We just need to set the right value of secret here.
Set and retrieve a secret from Azure Key Vault using PowerShell
Please let me know if this helps.
----------
If answer helps, please mark it 'Accept Answer'