public async Task <(Client client, string secret)> CreateClientAsync(string instance, string branch, IEnumerable <string> allowedApis) { Guid clientId = Guid.NewGuid(); string secret = GenerateSecret(); ClientEntity entity = new ClientEntity(); foreach (var grant in GrantTypes.ClientCredentials) { entity.AllowedGrantTypes.Add(grant); } foreach (var api in allowedApis) { entity.AllowedScopes.Add(api); } entity.ClientId = clientId.ToString(); entity.ClientSecrets.Add(secret.Sha256()); entity.AdditionalClaims.Add(new ClientEntity.Claim() { Type = "Instance", Value = instance }); entity.AdditionalClaims.Add(new ClientEntity.Claim() { Type = "Branch", Value = branch }); var contianer = this.blobClient.GetContainer(ClientContainer); await contianer.SetItemAsync(entity.ClientId, entity); return(entity.AsIdentityModel(), secret); }