Hi @ismcagdas, Thanks for getting back. I'm going to reach out to our partner and Zero customer, Synapsis Software. How do I add a second developer account to Zero's github pages and forum?
Hi Guys,
Still banging my head against a wall with this one. I have a branch with all commits at [resolves #3217: Added Azure Vault Configuration Provider support](https://github.com/aspnetzero/aspnet-zero-core/commit/c9d3b3b8617d65a5a46e52740e97fe786f52bf6e).
My infrastructure guys have set me up with a Key Vault with all sensitive information and supplied me with the ClientId
and ClientSecret
.
My code hits AppAzureKeyVaultConfigurer
early in the startup process and successfully hits the following code block:
else if (azureKeyVaultConfiguration.UsesManagedIdentity())
{
builder.AddAzureKeyVault(
azureKeyVaultUrl,
azureKeyVaultConfiguration.ClientId,
azureKeyVaultConfiguration.ClientSecret, new DefaultKeyVaultSecretManager());
}
However, the return from ProjectnameConnectionStringResolver.GetNameOrConnectionString()
returns the value from appsettings.json
and not from the Key Vault. I am currently in the development environment, would this make a difference?
If so how do I test?
Any advice on what I should do or look out for from here?
@maliming, thanks. We are scripting to move to a new Azure tenant to give us front line support from Microsoft with support from ClearCloud. We have been advised to move to Azure Key Vault/Appconfig. We can't move to azure.appconfig because Volosoft have never updated from aspnet framework 4.6 and azure..appconfig requires a minimum of 4.7. I would very much appreciate any support you can give as we migrate from one Azure tenant to another and, at the same time, try to apply Key Vault. I will keep you updated and would appreciate your support whilst this migration is happening.
dotnet core, angular, aspnet framework, Zero 6.8.0 I apologise for asking a question about such an old version of the product but an upgrade when we are so close to general market is out of the question! Having said this I would like to upgrade my Zero 6.8.0 system version to run with Azure's Key Vault. Am I correct that if I make the changes here: Added Azure Vault Configuration Provider support and follow the instructions here: Azure Key Vault Support and here: Using Azure Key Vault with ASP.NET Core that I should be able to implement? Is there any need for the plumbing outlined here: Azure Vault Configuration Provider or here: Azure Vault - Configuration Provider?
Any help, guidance or gotchas gratefully received.
Excellent - it was this:
_settingManager.GetSettingValueForTenant(TimingSettingNames.TimeZone, tenantId)
that I was missing. Thanks.
@adam, In my case I charge per device connected to the system. A tenant must register via the web first and each device must be authorised so I can charge on a pro-rata basis for usage per day per month. Therefore the tenancyname is always known. Any user can use any device but the devices are carefully managed. I think the business case is probably different to yours but good luck with the project!
@rickfrankel - thanks, I've been looking for that code and that little piece of advice for ages.
@adam If you're using Ionic for app development see here: Ionic reop integrated with Zero The way I have achieved a single app for all tenants is to build a registration system. Enter the tenant name in the app and pass back the tenantId which should be saved to local storage and used for all cookies thereafter. I have added a further step which is to register the device, notify the admin who then has to authorise the device before it can be used. Implement a device SignalR service so the device can be controlled from the server (i.e. found, tracked and local storage removed in case of a possible security breach).
@rajalla, see here: getting Hangfire to work in Zero
dotnetcore, angular, aspnet framework Zero 6.8.0 I am working with stored procedures and need to pass a "From" date parameter which is midnight in utc as calculated by the timezone of the tenant. In my web module I have:
Clock.Provider = ClockProviders.Utc;
I have a tenant in the UK: (currently GMT + 1) and a tenant in South Africa: (currently GMT + 2)
The relevant method in my SQLRepository class is set up as follows:
public async Task<IQueryable<GetEntitiesForKendoGrid_Result>> GetNcEntitiesForKendoGrid(int tenantId, long userId, int isDeleted)
{
await EnsureConnectionOpen();
var parms = new SqlParameter[4];
parms[0] = new SqlParameter("@TenantId", tenantId);
parms[1] = new SqlParameter("@UserId", userId);
parms[2] = new SqlParameter("@IsDeleted", isDeleted);
parms[3] = new SqlParameter("@From", Clock.Now.Date.ToUniversalTime());
using (var command = CreateCommand("GetEntitiesForKendoGrid", CommandType.StoredProcedure, parms))
.. code removed for brevity
Times in my database are all set to UTC. Regardless of changing the timezone for the client the following code line:
var timeZoneInfo = await _timeZoneService.GetDefaultTimezoneAsync(SettingScopes.Tenant, AbpSession.TenantId);
always gives me "GMT Standard Time"
The purpose of the exercise is to return midnight last night in UTC. My UK value should be "2020-08-17 23:00" My South African value should be "2020-08-17 22:00"
I have tried to inject ITimeZoneConverter
to get something like midnight:
var midnight = _timeZoneConverter.Convert(Clock.Now.Date);
which gives me "2020-08-18 00:00".
The nearest I have come to finding a solution is:
public async Task<IQueryable<GetEntitiesForKendoGrid_Result>> GetNcEntitiesForKendoGrid(int tenantId, long userId, int isDeleted)
{
await EnsureConnectionOpen();
var timeZoneInfo = await _timeZoneService.GetDefaultTimezoneAsync(SettingScopes.Tenant, AbpSession.TenantId);
var tz = TimeZoneInfo.FindSystemTimeZoneById(timeZoneInfo);
var midnight = new DateTime(Clock.Now.Date.Ticks, DateTimeKind.Unspecified);
var midnightUTC = TimeZoneInfo.ConvertTimeToUtc(midnight, tz);
var parms = new SqlParameter[4];
parms[0] = new SqlParameter("@TenantId", tenantId);
parms[1] = new SqlParameter("@UserId", userId);
parms[2] = new SqlParameter("@IsDeleted", isDeleted);
parms[3] = new SqlParameter("@From", midnightUTC);
using (var command = CreateCommand("GetEntitiesForKendoGrid", CommandType.StoredProcedure, parms))
.. code removed for brevity
Which seems a little cumbersome but I still can't figure out why i can'e get the relevant timezone for the tenant. Any help most appreciated.