Feeds:
Posts
Comments

Introduction

Visual Studio 2013 includes a lot of great tools to make Azure development painless. But sometimes you need to diagnose, debug or troubleshoot programs installed in the actual Azure envirnoment. Here is a quick tutorial on how to enable and inspect debugging information in Azure.

Follow these steps to configure logging in an Azure application.

Step 1. Define listener

To enable logging you need to add an Azure DiagnosticMonitorTraceListener. You can simply configure this in the app.config or web.config of your application.

The sample below is from the app.config of a WorkRole.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.diagnostics>
    <trace>
      <listeners>
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
          <filter type="" />
        </add>
      </listeners>
    </trace>
  </system.diagnostics>
  <appSettings>
...

Step 2. Get authorisation key

The logging (trace) informationin Azure is stored in an Azure Storage account. With some project types a storage account is automatically created when you publish from Visual Studio. If not you can always create a new one. Here is a screenshot of mine.
Azurestorageaccount

Click on your storage account. On the main dashboard page there will be a button at the bottom called: ‘Manage Access Keys’.
AzureManageKeysbutton

Click it.
You now get a pop-up where you can create/gererate access keys. Generate aone and temporarily copy the “primary access key” to notepad. We will need it later on.
AzureManageKeys

Step 3. Configure connectionstring

In the configuration file of your application configure a “diagnostic connectionstring”. Make sure your enter your Authorisation key correctly!

The sample below is taken from the file: ‘ServiceConfiguration.Cloud.cscfg’ of an Azure WorkerRole I created.

  <Role name="SiteProvisioning.WorkerRole">
    <Instances count="1" />
    <ConfigurationSettings>
      <Setting name="DiagnosticsConnectionString" value="DefaultEndpointsProtocol=https;AccountName=provisioningworkerrole;AccountKey=YourKey" />
...
    </ConfigurationSettings>

Replace ‘YourKey’ with the key you generated in step 2!

Step 4. Activate in code and usage.

Next step is to start the diagnostics in your application. Make sure that in the code below you rename “DiagnosticsConnectionString” to the name you defined in step 3.

public override bool OnStart()
{
   ServicePointManager.DefaultConnectionLimit = 12;
   var diagnosticMonitorConfiguration = DiagnosticMonitor.GetDefaultInitialConfiguration();
   diagnosticMonitorConfiguration.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
   diagnosticMonitorConfiguration.Logs.ScheduledTransferLogLevelFilter = Microsoft.WindowsAzure.Diagnostics.LogLevel.Verbose;
   DiagnosticMonitor.Start("DiagnosticsConnectionString", diagnosticMonitorConfiguration);

   return base.OnStart();
}

Use the .Net Trace infrastructure to log information to your log.

        private void ProcessItems()
        {
            try
            {
                Trace.TraceInformation("Working...");
                //TODO: do stuff
            }
            catch (Exception ex)
            {
                Trace.TraceError("Exception while processing: " + ex.Message, ex );
            }

            Trace.Flush();
        }

Inspecting the logs.

The trace information is stored in the table ‘WadLogsTable’ in your Azure Storage account. You will need a 3rd party tool to inspect the logs in Azure. I used Azure Management Studio. It’s not free but you can download a 30 day trial. I also use this tool to empty and query my Trace information.

The tool is easy. You download a connection file from your Azure site. Import the file into the application and you can start using it.

You find your table containing the Trace information in:
YourSubscription — Storage Accounts — YourStorageName — Tables — WADLogsTable

azuremanagement

With compose button you can define a query. Handy if you want to limit the results to a certain timeframe.

That’s it. Happy debugging.

Introduction

Set the site collection sharing (capabilities) properties in SharePoint Online by using clientside code.

Sharing Capabilities

With SharePoint Online you can set the “Sharing properties” of a site collection to one of the following 3 properties.

  • Don’t allow sharing outside your organization
  • Allow external users who accept sharing invitations and sign in as authenticated users
  • Allow both external users who accept sharing invitations and anonymous guest links

You set this by going to your SharePoint online tendant site and use the “Share” button in the Site Collection overview. You get this screen

scSharing

Code

You can also set this option by code by using the method ‘GetSitePropertiesByUrl()’ that returns Microsoft.Online.SharePoint.TenantAdministration.SiteProperties object.

Note: There is an other method called ‘GetSiteProperties()’ which will not work since it returns a ‘SPOSitePropertiesEnumerable’ object.

See all the possible options for Microsoft.Online.SharePoint.TenantManagement.SharingCapabilities here.

CSOM sample.

using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.Online.SharePoint.TenantManagement;

...
using (var tenantContext = TokenHelper.GetClientContextForApp(new Uri(TenantSite)))
{
	// Get properties of new Site Collection
	SiteProperties siteprops = tenant.GetSitePropertiesByUrl("https://yourName.sharepoint.com/", true);
	tenantContext.Load(siteprops);
	tenantContext.ExecuteQuery();

	// Set the Sharing option of the new site collection
	siteprops.SharingCapability = SharingCapabilities.ExternalUserSharingOnly;
	siteprops.Update();
	tenantContext.ExecuteQuery();
}

With a little effort it can be easliy converted to a JavaScript or PowerShell based script.

Starting from July 2014 there will be monthly CU updates instead of bi-monthly.

For more information see the site of Stefan Grossner

Makes me wonder if this will be on-par with the SP Online version or if the SharePoint on-prem is merely catching up.

When making changes in “Search Schema” of your SharePoint environment you sometimes need to restart the crawler to properly index the changes.

When to reindex your content?

Found a nice overview in this article:
http://technet.microsoft.com/en-us/library/jj219667(v=office.15).aspx

Managed property setting Action Requires a full crawl to reindex
Mapping a crawled to a managed property Add/Delete mapping Yes
Token normalization Enable/Disable Yes
Complete matching Enable/Disable Yes
Company name extraction Enable/Disable Yes
Custom entity extraction Enable/Disable Yes
Searchable Enable/Disable Yes
Queryable Enable Yes
Queryable Disable No
Retrievable Enable Yes
Retrievable Disable No
Refinable Enable (if not already Sortable) Yes
Refinable Disable No
Sortable Enable (if not already Refinable) Yes
Sortable Disable No
Alias Add/Delete No

The amount of refiners you can define in SharePoint online is limited. You basicaly need to link a property to a predefined managed property and set an alias.

Found an overview of the predefined managed properties here:
http://technet.microsoft.com/en-us/library/jj219667(v=office.15).aspx#DefaultUnusedMPs

Managed property type Count Managed property characteristics Managed property name range

Date

10

Queryable

Date00 to Date09

Date

20

Multivalued, Queryable, Refinable, Sortable, Retrievable

RefinableDate00 to RefinableDate19

Decimal

10

Queryable

Decimal00 to Decimal09

Decimal

10

Multivalued, Queryable, Refinable, Sortable, Retrievable

RefinableDecimal00 to RefinableDecimal09

Double

10

Queryable

Double00 to Double09

Double

10

Multivalued, Queryable, Refinable, Sortable, Retrievable

RefinableDouble00 to RefinableDouble09

Integer

50

Queryable

Int00 to Int49

Integer

50

Multivalued, Queryable, Refinable, Sortable, Retrievable

RefinableInt00 to RefinableInt49

String

100

Multivalued, Queryable, Refinable, Sortable, Retrievable

RefinableString00 to RefinableString99

A quick update on my “Overview of all SharePoint 2013 updates” article.

Last September I created a PDF file with an overview of all the issues fixed with the SharePoint CU updates.
I updated this file with the October 2013 CU and December 2013 CU updates for SharePoint 2013 Server and SharePoint 2013 Foundation. It has become quite a big listing with 20 pages of issues and bugs fixed by the SharePoint 2013 CU updates.

List with all fixed issues

You can download the file here:

http://www.amtopm.be/DL/OverviewSharePoint2013Updates.pdf

To download the actual updates or for more information about the updates: visit the blog of Stefan Go├čner

General remarks

Note 1 that the “December 2013 CU for SharePoint 2013″ update exists out of two files that need to be placed in the same folder before starting the install.
Note 2 The Project Server 2013 fixes are not included in this update. If you have a project server 2013 you need to install the extra update 2837668

Have fun,
Wouter

“Ask me about” property.

If you want to search or disable the refinements of the “Ask Me About” property from the user profile, look for Managed property “Responsibilities“. Or the crawled property “SPS-Responsibilities”.

Displaying this property in the refinements turned out not to be that helpful. Disabling it is a breeze, if you know the correct (internal) name.

Regards,
Wout

Follow

Get every new post delivered to your Inbox.