Created
September 14, 2023 02:11
-
-
Save swordfish6975/d1caeb907ba0054d2bc1ca0e40d300de to your computer and use it in GitHub Desktop.
Extract the Function App Settings your looking for from all of Azure (that you have access to)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Azure.Identity; | |
| using Azure.ResourceManager; | |
| using Azure.ResourceManager.AppService; | |
| using Newtonsoft.Json; | |
| namespace AzureSettingsFinder | |
| { | |
| internal class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Console.WriteLine("Started..."); | |
| var target = args[0]; | |
| ArmClient client = new(new DefaultAzureCredential()); | |
| foreach (var subs in client.GetSubscriptions()) | |
| { | |
| foreach (var resGroups in subs.GetResourceGroups()) | |
| { | |
| foreach (var website in resGroups.GetWebSites()) | |
| { | |
| try | |
| { | |
| var setttings = website.GetApplicationSettings(); | |
| var props = setttings.Value.Properties.Where(x => x.Key.Contains(target) || x.Value.Contains(target)); | |
| foreach (var prop in props) | |
| { | |
| Console.WriteLine($"Name: {website.Data.Name} Target: {target} Key: {prop.Key} Value: {prop.Value}"); | |
| } | |
| } | |
| catch (Exception ex) | |
| { | |
| // Console.WriteLine($"ERROR: {website.Data.Name} {ex.Message} | {ex.InnerException}"); | |
| } | |
| } | |
| } | |
| } | |
| Console.WriteLine("Done."); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment