Closed ghost closed 5 years ago
What specifically do you need in order to clean up a deployment?
$ConfigASDKLog = Get-ChildItem -Path C:\ConfigASDK\Logs\ -Filter ConfigASDKLog. -Recurse $ConfigASDKLog = Get-Content -Path $ConfigASDKLog.FullName $asdkregEntry = $ConfigASDKLog -match '\"ResourceName"\: \"asdkreg' | Select-Object -First 1 $asdkregEntry -match '.+\"(.+)\",' $asdkreg = $Matches[1] $asdkreg
Import-Module C:\AzureStack-Tools-master\Registration\RegisterWithAzure.psm1
Add-AzureRmAccount -Credential $AzureADCredentail
Remove-AzsRegistration -PrivilegedEndpointCredential $CloudAdminCred -PrivilegedEndpoint AzS-ERCS01 -RegistrationName $asdkreg
This is what i now do because i didn't had the "asdkreg" reg name. But it maybe would be handy for all generated key's to be exported.
Ok. Would you need the AAD cred, perhaps just the regUserName and sub Id? I could create a separate text file or CSV and then deposit it inside the Completed folder when the run is finished. It would just contain AAD User, RegSubID and the registration info (rg, name etc) but you’d still have to write a script like that above to grab the info.
Also, for the above, you can be more specific with the query by using asdkreg-$computerName* ( see actual configasdk.ps1 for specifics)
Is the registration the only thing you’re looking to clean up?
OK, so in 1811.2, the script will now create 2 PS1 files and store them in the Completed folder, for that particular deployment. The PS1 files will clean up registration, and the App Service Azure AD app respectively. The PS1 files will be automatically generated by the script itself, and will be populated with information pertinent to that deployment, but not sensitive password information.
All the user would need to do, ahead of redeploying, is run both of those scripts, enter passwords when prompted, and the scripts should take care of the cleanup.
I don't know how to clean up the rest of the ASDK Azure AD integration - an ASDK Azure AD deployment creates a good number of Azure AD apps, none of which have a common ID that i can see, but if you find something, let me know, and I'll figure something out.
Closing for now, and will re-open if 1811.2 doesn't fit the bill...
Is it possible to write out an export of all variables that are used during the deployment. I'm now writing a script to clean up the installation for redeploy of the ASDK. Now i have to extract the information from the log file and it could be handy if there is a (hash)file I can import for that information.