diff --git a/src/ApiService/ApiService/ApiService.csproj b/src/ApiService/ApiService/ApiService.csproj index 93b299b43d..1b1fb1a064 100644 --- a/src/ApiService/ApiService/ApiService.csproj +++ b/src/ApiService/ApiService/ApiService.csproj @@ -15,19 +15,19 @@ - - - - - - - - + + + + + + + + - - - - + + + + diff --git a/src/ApiService/ApiService/onefuzzlib/Creds.cs b/src/ApiService/ApiService/onefuzzlib/Creds.cs index 290f0ad79a..e98f5d05be 100644 --- a/src/ApiService/ApiService/onefuzzlib/Creds.cs +++ b/src/ApiService/ApiService/onefuzzlib/Creds.cs @@ -25,7 +25,6 @@ public DefaultAzureCredential GetIdentity() return new DefaultAzureCredential(); } - // TODO: @cached public string GetSubcription() { var storageResourceId = EnvironmentVariables.OneFuzz.DataStorage @@ -34,7 +33,6 @@ public string GetSubcription() return storageResource.SubscriptionId!; } - // TODO: @cached public string GetBaseResourceGroup() { var storageResourceId = EnvironmentVariables.OneFuzz.DataStorage diff --git a/src/ApiService/ApiService/onefuzzlib/Storage.cs b/src/ApiService/ApiService/onefuzzlib/Storage.cs index afefbfd77e..254c3a28d6 100644 --- a/src/ApiService/ApiService/onefuzzlib/Storage.cs +++ b/src/ApiService/ApiService/onefuzzlib/Storage.cs @@ -26,30 +26,29 @@ public interface IStorage public class Storage : IStorage { private ICreds _creds; + private ArmClient _armClient; public Storage(ICreds creds) { _creds = creds; + _armClient = new ArmClient(credential: _creds.GetIdentity(), defaultSubscriptionId: _creds.GetSubcription()); } - // TODO: @cached public static string GetFuncStorage() { return EnvironmentVariables.OneFuzz.FuncStorage ?? throw new Exception("Func storage env var is missing"); } - // TODO: @cached public static string GetFuzzStorage() { return EnvironmentVariables.OneFuzz.DataStorage ?? throw new Exception("Fuzz storage env var is missing"); } - // TODO: @cached public ArmClient GetMgmtClient() { - return new ArmClient(credential: _creds.GetIdentity(), defaultSubscriptionId: _creds.GetSubcription()); + return _armClient; } // TODO: @cached @@ -63,7 +62,7 @@ public IEnumerable CorpusAccounts(ILogTracer log) const string storageTypeTagKey = "storage_type"; - var resourceGroup = client.GetResourceGroup(group); + var resourceGroup = client.GetResourceGroupResource(group); foreach (var account in resourceGroup.GetStorageAccounts()) { if (account.Id == skip) @@ -109,7 +108,7 @@ public string GetPrimaryAccount(StorageType storageType) { var resourceId = new ResourceIdentifier(accountId); var armClient = GetMgmtClient(); - var storageAccount = armClient.GetStorageAccount(resourceId); + var storageAccount = armClient.GetStorageAccountResource(resourceId); var key = storageAccount.GetKeys().Value.Keys.FirstOrDefault(); return (resourceId.Name, key?.Value); } diff --git a/src/ApiService/ApiService/onefuzzlib/orm/StorageProvider.cs b/src/ApiService/ApiService/onefuzzlib/orm/StorageProvider.cs index 5be553fdb7..1d17ea18ce 100644 --- a/src/ApiService/ApiService/onefuzzlib/orm/StorageProvider.cs +++ b/src/ApiService/ApiService/onefuzzlib/orm/StorageProvider.cs @@ -44,7 +44,7 @@ public async Task GetTableClient(string table) public (string?, string?) GetStorageAccountNameAndKey(string accountId) { var resourceId = new ResourceIdentifier(accountId); - var storageAccount = _armClient.GetStorageAccount(resourceId); + var storageAccount = _armClient.GetStorageAccountResource(resourceId); var key = storageAccount.GetKeys().Value.Keys.FirstOrDefault(); return (resourceId.Name, key?.Value); } diff --git a/src/ApiService/ApiService/packages.lock.json b/src/ApiService/ApiService/packages.lock.json index 2b96328ede..885036b6ad 100644 --- a/src/ApiService/ApiService/packages.lock.json +++ b/src/ApiService/ApiService/packages.lock.json @@ -4,9 +4,9 @@ "net6.0": { "Azure.Core": { "type": "Direct", - "requested": "[1.23.0, )", - "resolved": "1.23.0", - "contentHash": "myulcGStD89NN7BUhAjkcfDhIvRj2UUwZHEgjB50pL3vb0LEunrtinxKqUGUuOheQVCHlILKLNoUeCThQ1iCOg==", + "requested": "[1.24.0, )", + "resolved": "1.24.0", + "contentHash": "+/qI1j2oU1S4/nvxb2k/wDsol00iGf1AyJX5g3epV7eOpQEP/2xcgh/cxgKMeFgn3U2fmgSiBnQZdkV+l5y0Uw==", "dependencies": { "Microsoft.Bcl.AsyncInterfaces": "1.1.1", "System.Diagnostics.DiagnosticSource": "4.6.0", @@ -29,81 +29,81 @@ }, "Azure.Identity": { "type": "Direct", - "requested": "[1.5.0, )", - "resolved": "1.5.0", - "contentHash": "VfF88dqrgKXZNOS/y4XrX/jmIfP3pkY+hBUzBNpoKml1nR+QshX6XlXWyToLtWV80TDQ1CmUVCJksktDg5+j1w==", + "requested": "[1.6.0, )", + "resolved": "1.6.0", + "contentHash": "EycyMsb6rD2PK9P0SyibFfEhvWWttdrYhyPF4f41uzdB/44yQlV+2Wehxyg489Rj6gbPvSPgbKq0xsHJBhipZA==", "dependencies": { - "Azure.Core": "1.20.0", - "Microsoft.Identity.Client": "4.30.1", - "Microsoft.Identity.Client.Extensions.Msal": "2.18.4", + "Azure.Core": "1.24.0", + "Microsoft.Identity.Client": "4.39.0", + "Microsoft.Identity.Client.Extensions.Msal": "2.19.3", "System.Memory": "4.5.4", - "System.Security.Cryptography.ProtectedData": "4.5.0", - "System.Text.Json": "4.6.0", + "System.Security.Cryptography.ProtectedData": "4.7.0", + "System.Text.Json": "4.7.2", "System.Threading.Tasks.Extensions": "4.5.4" } }, "Azure.Messaging.EventGrid": { "type": "Direct", - "requested": "[4.9.0, )", - "resolved": "4.9.0", - "contentHash": "ooM1/ueb5pVIf+/BmS/SQKGW0LuP2Rn1Zc+RasCF0aMkJ5/kbc4ZXVrUd2YQlDaoeUOTJGSLs/VoGv0W1GiS5g==", + "requested": "[4.10.0, )", + "resolved": "4.10.0", + "contentHash": "X3dh3Cek/7wFPUrBJ2KbnkJteGjWvKBoSBmD/uQm8reMIavCFTKhnl95F937eLn/2cSsm5l3oPHtYPFtDerA7Q==", "dependencies": { - "Azure.Core": "1.22.0", + "Azure.Core": "1.24.0", "System.Memory.Data": "1.0.2", "System.Text.Json": "4.7.2" } }, "Azure.ResourceManager": { "type": "Direct", - "requested": "[1.0.0-beta.8, )", - "resolved": "1.0.0-beta.8", - "contentHash": "L8fYEV5kjP+BY1d9J7/hzQ/IHr1capJn9gkhzAEY4BPvMFTE9Aqsbb3p06r+iItcLP0y87eacQodfyPczADXVg==", + "requested": "[1.0.0, )", + "resolved": "1.0.0", + "contentHash": "UGaoiPcJ8a9Et030+F3zc2KhTssPAgPm7uXm4E9kyNI4jYYenUe6zj2J1bTimaTfcOZnn5scSjSYxKtZCzftcA==", "dependencies": { - "Azure.Core": "1.22.0", + "Azure.Core": "1.24.0", "System.Text.Json": "4.7.2" } }, "Azure.ResourceManager.Compute": { "type": "Direct", - "requested": "[1.0.0-beta.6, )", - "resolved": "1.0.0-beta.6", - "contentHash": "equl7PjMwhmFFj3qewcK+2kqbEQUM64elLan6jPIxRbHQkQ/QOm/mHRWuTerW0BdUvj48e+odB6gJc4wW0aZbQ==", + "requested": "[1.0.0-beta.8, )", + "resolved": "1.0.0-beta.8", + "contentHash": "rYYjjmEdmcOa8O4UgO/bdJ/qQclNZjuHdalxRJ0AhUHCORcM1f1BbIKR9CoN83IpfuEE+X+n5XY9QZcKvfrGVA==", "dependencies": { - "Azure.Core": "1.22.0", - "Azure.ResourceManager": "1.0.0-beta.8", + "Azure.Core": "1.24.0", + "Azure.ResourceManager": "1.0.0", "System.Text.Json": "4.7.2" } }, "Azure.ResourceManager.Network": { "type": "Direct", - "requested": "[1.0.0-beta.5, )", - "resolved": "1.0.0-beta.5", - "contentHash": "F7p/eZatJ+8hPfHR+98LgNJC+nBH4GBDtluLk+ubgIF84DZ9KMjRSkvyv4d6Y9k8jHh8qYRt4lUUMpdwseSutA==", + "requested": "[1.0.0-beta.7, )", + "resolved": "1.0.0-beta.7", + "contentHash": "Ih8tb6OwxEEEEXATVzgX6oHJzVr9p4X6GfOfBnNAI3aIt9+G8blyQLltaCcJAGJ+dO1sBT/Nalgj/HinO+cBlw==", "dependencies": { - "Azure.Core": "1.21.0", - "Azure.ResourceManager": "1.0.0-beta.7", - "System.Text.Json": "4.6.0" + "Azure.Core": "1.24.0", + "Azure.ResourceManager": "1.0.0", + "System.Text.Json": "4.7.2" } }, "Azure.ResourceManager.Resources": { "type": "Direct", - "requested": "[1.0.0-beta.6, )", - "resolved": "1.0.0-beta.6", - "contentHash": "tKGuoj5WXte2YZWSfYVertSr8zAjg1pRqoRZkRPfntzSqBrTx7BrspEh6iNZyJngW0L33LOlHcvCvvosz0WJGQ==", + "requested": "[1.0.0, )", + "resolved": "1.0.0", + "contentHash": "oNQRWfh05v9BiY8DMQjV+++kVafR+3ry2FGfMKObovKNfAb4i5J6DQpv0CUIx4jeIZe0fnhxyXRRCe293YtMqw==", "dependencies": { - "Azure.Core": "1.22.0", - "Azure.ResourceManager": "1.0.0-beta.8", + "Azure.Core": "1.24.0", + "Azure.ResourceManager": "1.0.0", "System.Text.Json": "4.7.2" } }, "Azure.ResourceManager.Storage": { "type": "Direct", - "requested": "[1.0.0-beta.6, )", - "resolved": "1.0.0-beta.6", - "contentHash": "zsBSj+cfBAgYzWAD7fRbTqyA7cALUeCeE2Tk34og2ZathKUl0Ngriki53u0dMif2LTkfKrO0UiBgyiNaeU/ixw==", + "requested": "[1.0.0-beta.8, )", + "resolved": "1.0.0-beta.8", + "contentHash": "tlVqStqG53lyGxr0dRq2KSkFdeC/+NQImWgsRXD9o5R4qBia4cx7zAGYBlnDeUxh1WldSZF5ZsBi2n5SAwxbxQ==", "dependencies": { - "Azure.Core": "1.22.0", - "Azure.ResourceManager": "1.0.0-beta.8", + "Azure.Core": "1.24.0", + "Azure.ResourceManager": "1.0.0", "System.Text.Json": "4.7.2" } }, @@ -200,40 +200,40 @@ }, "Microsoft.Graph": { "type": "Direct", - "requested": "[4.20.0, )", - "resolved": "4.20.0", - "contentHash": "Pf8hdObmX3qF0AREu9e4dnk7inc3Pfw/sI/6l4RGTWDoORpP3Oyh0JoT/TJ+VIUaDk0W4fCUS0zSKhLpOr2UsQ==", + "requested": "[4.24.0, )", + "resolved": "4.24.0", + "contentHash": "OPyHQ+EzuYjp3XExGB0SvySXY3pxU+bXLl3ADdvje/yOMFvpNOpEu111tmh2aM/RCplaoMQjBA5oa9pUVIH0cg==", "dependencies": { "Microsoft.Graph.Core": "2.0.8" } }, "Microsoft.Identity.Client": { "type": "Direct", - "requested": "[4.42.0, )", - "resolved": "4.42.0", - "contentHash": "BQeEI4mKDJaludUZwZXfmAs7y1Lhkbm81KDg4Q3JWY8tXi5S7vFFJ4+xcrZtEEuqtDnyhP+Yx0u+1PeOALuTGA==" + "requested": "[4.43.0, )", + "resolved": "4.43.0", + "contentHash": "uaUMZB3Ywi7IPVvgRZOQotlYhD8sA4wtZESkA0qF9SYAifr1RzJyaGTFtfbAyZ/J5kGUhRklrCJIRpd0MaihKQ==" }, "Microsoft.Identity.Web.TokenCache": { "type": "Direct", - "requested": "[1.23.0, )", - "resolved": "1.23.0", - "contentHash": "hk4x8v0fjfjxsYwUtamuYczlZS9zyk+g8tlaPFnEPo7ldFJjf/w912faFPqcDJoC8Va5Ykyw1prdQouORAn9zg==", + "requested": "[1.23.1, )", + "resolved": "1.23.1", + "contentHash": "fU85i6XDUXL/z6B+pTmNZbof0hL9Jkgsi6GWpQEWjL7Ek0GH0A8btxbqzojPCRdGN7EK/vyEVu5Smy9/spZj2g==", "dependencies": { "Microsoft.AspNetCore.DataProtection": "5.0.8", "Microsoft.Extensions.Caching.Memory": "5.0.0", "Microsoft.Extensions.Logging": "5.0.0", - "Microsoft.Identity.Client": "4.41.0", + "Microsoft.Identity.Client": "4.42.0", "System.Text.Encodings.Web": "5.0.1" } }, "System.IdentityModel.Tokens.Jwt": { "type": "Direct", - "requested": "[6.16.0, )", - "resolved": "6.16.0", - "contentHash": "QnZUawkmLkzEhwgvlqcm2YNAoRgz27zVY+2LzMBMWMcfFhl2Sv8aavZOeuFMofmYJsST9h7BilOn7MzFSUMihQ==", + "requested": "[6.17.0, )", + "resolved": "6.17.0", + "contentHash": "G3rY4WLr54Mo+97+AEq0ANpiKvW7E8Qu5bKWfVMa7rkyJtvrOxUqp/OLqrGw/6JDbD5GlxnAtFKukGteUuB0rQ==", "dependencies": { - "Microsoft.IdentityModel.JsonWebTokens": "6.16.0", - "Microsoft.IdentityModel.Tokens": "6.16.0" + "Microsoft.IdentityModel.JsonWebTokens": "6.17.0", + "Microsoft.IdentityModel.Tokens": "6.17.0" } }, "System.Linq.Async": { @@ -691,25 +691,25 @@ }, "Microsoft.Identity.Client.Extensions.Msal": { "type": "Transitive", - "resolved": "2.18.4", - "contentHash": "HpG4oLwhQsy0ce7OWq9iDdLtJKOvKRStIKoSEOeBMKuohfuOWNDyhg8fMAJkpG/kFeoe4J329fiMHcJmmB+FPw==", + "resolved": "2.19.3", + "contentHash": "zVVZjn8aW7W79rC1crioDgdOwaFTQorsSO6RgVlDDjc7MvbEGz071wSNrjVhzR0CdQn6Sefx7Abf1o7vasmrLg==", "dependencies": { - "Microsoft.Identity.Client": "4.30.0", + "Microsoft.Identity.Client": "4.38.0", "System.Security.Cryptography.ProtectedData": "4.5.0" } }, "Microsoft.IdentityModel.JsonWebTokens": { "type": "Transitive", - "resolved": "6.16.0", - "contentHash": "FJtXVXvjoza64VPFOPBxqnhe0yyQ5B/7A09+RpTXIzowr5+A4xcX42patsLrNGmFUvXZAHhS2u/6ojTzhYatpg==", + "resolved": "6.17.0", + "contentHash": "I3cSVE185qF3a222/iQIdmBFhrhZBtz7wZ1RUUbMuHC1un79XCI7vggbWdmbqIttFcUoeziemadO6t+3FLjcSA==", "dependencies": { - "Microsoft.IdentityModel.Tokens": "6.16.0" + "Microsoft.IdentityModel.Tokens": "6.17.0" } }, "Microsoft.IdentityModel.Logging": { "type": "Transitive", - "resolved": "6.16.0", - "contentHash": "Fuo5SpYUpFRw90hBM3PDA1uQsrHmbIaxvwkldJcfi0O51gz/qjSFMe8136NFRoKA3NxZZScpz/47oFkRU2WA/A==" + "resolved": "6.17.0", + "contentHash": "Ix6/CMLDoo939NDf1ARDuGK6YERY7pAX9WYbfwb4gZqx7r52unMFIykJk+zlEBX7jjtbDz/0uzikQFvheV9KsQ==" }, "Microsoft.IdentityModel.Protocols": { "type": "Transitive", @@ -731,11 +731,11 @@ }, "Microsoft.IdentityModel.Tokens": { "type": "Transitive", - "resolved": "6.16.0", - "contentHash": "dL7r4bdRbDG0RmyYGw9cpO/pA3GVaxV+lI1ConYuQuRiAxd1ONFlxHue1o8wR8+lEB972cekzfj45WSNaq3+xA==", + "resolved": "6.17.0", + "contentHash": "mhOe+d9BQg5U45TkTCyXAFOjl7RvwaFj6v9qo8b+WFolkuGsfjSFfQ+WI9D3ho9sD/fK75gvL4JptmjLzyUPkw==", "dependencies": { "Microsoft.CSharp": "4.5.0", - "Microsoft.IdentityModel.Logging": "6.16.0", + "Microsoft.IdentityModel.Logging": "6.17.0", "System.Security.Cryptography.Cng": "4.5.0" } }, @@ -950,8 +950,8 @@ }, "System.Security.Cryptography.ProtectedData": { "type": "Transitive", - "resolved": "4.5.0", - "contentHash": "wLBKzFnDCxP12VL9ANydSYhk59fC4cvOr9ypYQLPnAj48NQIhqnjdD2yhP8yEKyBJEjERWS9DisKL7rX5eU25Q==" + "resolved": "4.7.0", + "contentHash": "ehYW0m9ptxpGWvE4zgqongBVWpSDU/JCFD4K7krxkQwSz/sFQjEXCUqpvencjy6DYDbn7Ig09R8GFffu8TtneQ==" }, "System.Security.Cryptography.Xml": { "type": "Transitive",