Tuesday, February 11, 2020
Thursday, January 23, 2020
Check File Permission for App Service Files in Azure
Below
is the permissions output of files in the wwwroot directory that I ran with a
Powershell command in Kudu site. So if you ever see the issue again and you
ensure stdoutLogFile="\\?\%home%\LogFiles\stdout" but still have issues, you may compare your Powershell
permissions output of your wwwroot directory to mine to see if they have same
access control:
You should use this when your web application isn't starting and giving you the permission error.
Navigate
to your Kudu site (yourApp.scm.azurewebsites.net) --> Debug Console -->
PowerShell --> navigate to wwwroot directory
(Run
the PS command below to show all files access control and pipe output to avoid
PS truncation of the results)
Dir
| Get-Acl | Format-List
You
can compare your output to mine:
F
PS
D:\home\site\wwwroot> Dir | Get-Acl | Format-List
Dir
| Get-Acl | Format-List
Path
: Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\wwwroot
Owner
: O:S-1-5-21-2996674325-4160296812-1073090115-501
Group
: G:S-1-5-21-2996674325-4160296812-1073090115-513
Access
: Everyone Allow DeleteSubdirectoriesAndFiles, Modify, Synchronize
BUILTIN\Administrators Allow FullControl
Audit
:
Sddl
:
O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4
160296812-1073090115-513D:AI(A;OICIID;0x1301ff;;;WD)(A;OICIID;FA;;;BA)
Path
: Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\appsettings
.Development.json
Owner
: O:S-1-5-21-2996674325-4160296812-1073090115-501
Group
: G:S-1-5-21-2996674325-4160296812-1073090115-513
Access
: Everyone Allow DeleteSubdirectoriesAndFiles, Modify, Synchronize
BUILTIN\Administrators Allow FullControl
Audit
:
Sddl
:
O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4
160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)
Path
: Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\appsettings
.json
Owner
: O:S-1-5-21-2996674325-4160296812-1073090115-501
Group
: G:S-1-5-21-2996674325-4160296812-1073090115-513
Access
: Everyone Allow DeleteSubdirectoriesAndFiles, Modify, Synchronize
BUILTIN\Administrators Allow FullControl
Audit
:
Sddl
:
O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4
160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)
Path
:
Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\hostingstar
t.html
Owner
: BUILTIN\Administrators
Group
: G:S-1-5-21-2996674325-4160296812-1073090115-513
Access
: Everyone Allow DeleteSubdirectoriesAndFiles, Modify, Synchronize
BUILTIN\Administrators Allow FullControl
Audit
:
Sddl
:
O:BAG:S-1-5-21-2996674325-4160296812-1073090115-513D:AI(A;ID;0x1301ff;
;;WD)(A;ID;FA;;;BA)
Path
: Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\web.config
Owner
: O:S-1-5-21-2996674325-4160296812-1073090115-501
Group
: G:S-1-5-21-2996674325-4160296812-1073090115-513
Access
: Everyone Allow DeleteSubdirectoriesAndFiles, Modify, Synchronize
BUILTIN\Administrators Allow FullControl
Audit
:
Sddl
:
O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4
160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)
Path
: Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\WebApplicat
ion4.deps.json
Owner
: O:S-1-5-21-2996674325-4160296812-1073090115-501
Group
: G:S-1-5-21-2996674325-4160296812-1073090115-513
Access
: Everyone Allow DeleteSubdirectoriesAndFiles, Modify, Synchronize
BUILTIN\Administrators Allow FullControl
Audit
:
Sddl
:
O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4
160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)
Path
:
Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\WebApplicat
ion4.dll
Owner
: O:S-1-5-21-2996674325-4160296812-1073090115-501
Group
: G:S-1-5-21-2996674325-4160296812-1073090115-513
Access
: Everyone Allow DeleteSubdirectoriesAndFiles, Modify, Synchronize
BUILTIN\Administrators Allow FullControl
Audit
:
Sddl
:
O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4
160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)
Path
:
Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\WebApplicat
ion4.pdb
Owner
: O:S-1-5-21-2996674325-4160296812-1073090115-501
Group
: G:S-1-5-21-2996674325-4160296812-1073090115-513
Access
: Everyone Allow DeleteSubdirectoriesAndFiles, Modify, Synchronize
BUILTIN\Administrators Allow FullControl
Audit
:
Sddl
:
O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4
160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)
Path
: Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\WebApplicat
ion4.runtimeconfig.json
Owner
: O:S-1-5-21-2996674325-4160296812-1073090115-501
Group
: G:S-1-5-21-2996674325-4160296812-1073090115-513
Access : Everyone Allow
DeleteSubdirectoriesAndFiles, Modify, Synchronize
BUILTIN\Administrators Allow FullControl
Audit
:
Sddl
:
O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4
160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)
Path
:
Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\WebApplicat
ion4.Views.dll
Owner
: O:S-1-5-21-2996674325-4160296812-1073090115-501
Group
: G:S-1-5-21-2996674325-4160296812-1073090115-513
Access
: Everyone Allow DeleteSubdirectoriesAndFiles, Modify, Synchronize
BUILTIN\Administrators Allow FullControl
Audit
:
Sddl
:
O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4
160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)
Path
:
Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\WebApplicat
ion4.Views.pdb
Owner
: O:S-1-5-21-2996674325-4160296812-1073090115-501
Group
: G:S-1-5-21-2996674325-4160296812-1073090115-513
Access
: Everyone Allow DeleteSubdirectoriesAndFiles, Modify, Synchronize
BUILTIN\Administrators Allow FullControl
Audit
:
Sddl
:
O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4
160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)
Sunday, December 15, 2019
Delete files older than x days on Azure Web App
Get files older than 30 days.
forfiles -s -m *.* -d -30 -c "cmd /c echo @file" (All files)
Once results look ok, change echo to delete.
forfiles -s -m *.* -d -30 -c "cmd /c del @file"
Change *.* to * if you want to include directories.
to have a condition
forfiles /p c:\ /s /m *.* /c "cmd /c if @isdir==TRUE echo @file is a directory"
Remove all directories from the current directory older than 3 days.
Wednesday, October 16, 2019
Angular App on AWS - S3 + Cloud Front
https://codeburst.io/deploy-angular-2-node-js-website-using-aws-1ac169d6bbf
https://medium.com/@peatiscoding/here-is-how-easy-it-is-to-deploy-an-angular-spa-single-page-app-as-a-static-website-using-s3-and-6aa446db38ef
Other
https://medium.com/zykrrtech/deploying-an-angular-7-application-to-aws-s3-cloudfront-serving-https-requests-f59a806c57b2
https://firstclassjs.com/deploy-angular-application-to-aws-s3-and-cloudfront/
https://medium.com/@peatiscoding/here-is-how-easy-it-is-to-deploy-an-angular-spa-single-page-app-as-a-static-website-using-s3-and-6aa446db38ef
Other
https://medium.com/zykrrtech/deploying-an-angular-7-application-to-aws-s3-cloudfront-serving-https-requests-f59a806c57b2
https://firstclassjs.com/deploy-angular-application-to-aws-s3-and-cloudfront/
Tuesday, October 15, 2019
HangFire Ioc Contaner - Job Schedular
Nuget :
Hangfire.AspNetCore
Hangfire.SqlServer (Redis can also be used)
services.AddHangfire(x => {
var options = new SqlServerStorageOptions
{
PrepareSchemaIfNecessary = true,
QueuePollInterval = TimeSpan.FromSeconds(5)
};
x.UseSqlServerStorage(Configuration.GetConnectionString("DefaultConnection"), options);
});
Hangfire.AspNetCore
Hangfire.SqlServer (Redis can also be used)
services.AddHangfire(x => {
var options = new SqlServerStorageOptions
{
PrepareSchemaIfNecessary = true,
QueuePollInterval = TimeSpan.FromSeconds(5)
};
x.UseSqlServerStorage(Configuration.GetConnectionString("DefaultConnection"), options);
});
//services.AddHangfire(configuration => {
// configuration.UseStorage(
// new MySqlStorage(
// "server=127.0.0.1;uid=root;pwd=root;database={0};Allow User Variables=True",
// new MySqlStorageOptions
// {
// TablesPrefix = "Hangfire"
// }
// )
// );
//};
//https://docs.hangfire.io/en/latest/configuration/using-sql-server.html
//https://docs.hangfire.io/en/latest/configuration/
//https://docs.hangfire.io/en/latest/getting-started/aspnet-core-applications.html
GlobalConfiguration.Configuration.UseSqlServerStorage(Configuration.GetConnectionString("DefaultConnection"));
GlobalConfiguration.Configuration.UseActivator(new ServiceJobActivator(serviceProvider.GetService<IServiceScopeFactory>(), serviceProvider));
//GlobalConfiguration.Configuration.UseActivator(new HangfireActivator(serviceProvider));
app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
});
app.UseHangfireServer(new BackgroundJobServerOptions {
WorkerCount= 1
});
Job Activator
public class ServiceJobActivator : JobActivator
{
readonly IServiceScopeFactory _serviceScopeFactory;
private readonly IServiceProvider _serviceProvider;
public ServiceJobActivator(IServiceScopeFactory serviceScopeFactory, IServiceProvider serviceProvider)
{
if (serviceScopeFactory == null) throw new ArgumentNullException(nameof(serviceScopeFactory));
_serviceScopeFactory = serviceScopeFactory;
_serviceProvider = serviceProvider;
}
public override JobActivatorScope BeginScope(JobActivatorContext context)
{
return new ServiceJobActivatorScope(_serviceScopeFactory.CreateScope());
}
public override object ActivateJob(Type type)
{
return _serviceProvider.GetService(type);
}
}
public class ServiceJobActivatorScope : JobActivatorScope
{
readonly IServiceScope _serviceScope;
public ServiceJobActivatorScope(IServiceScope serviceScope)
{
if (serviceScope == null) throw new ArgumentNullException(nameof(serviceScope));
_serviceScope = serviceScope;
}
public override object Resolve(Type type)
{
return _serviceScope.ServiceProvider.GetService(type);
}
}
In the service, inject IBackgroundJobClient backgroundJobs and use
_backgroundJobs.Enqueue<ISampleService>(s => s.CallFunction());
Thursday, September 5, 2019
Generate Dynamic Data
Use following apps to generate the dynamics data based on the schema that you give.
https://www.mockaroo.com/
http://www.databasetestdata.com/
http://www.generatedata.com/#t1
https://www.mockaroo.com/
http://www.databasetestdata.com/
http://www.generatedata.com/#t1
Monday, August 19, 2019
Create Docker container with the image less than 90 days old
Please add -accept_eula in the command to create the container.
Sample Command
Sample Command
New-NavContainer -containerName NAV2017 -accept_eula -accept_outdated -alwaysPull -auth Windows -authenticationEMail test@bizcentralus.onmicrosoft.com -imageName mcr.microsoft.com/dynamicsnav:2017-cu3-na -includeCSide -licenseFile "C:\ABC.flf" -useSSL
Subscribe to:
Posts (Atom)