Thursday, February 18, 2016

Deployment to resource group ‘Resource Group Name’ failed in Windows Azure

Environment: Windows Azure

Requirement: Create a SharePoint Server 2013 trial Virtual Machine in Azure.

Error: Deployment to resource group ‘Resource Group Name’ failed.

Issue: The deployment failed with the following an error at event Microsoft.Resources/deployments/write

Deployment failed error

Troubleshooting: From the audit log detail, it is understood that this is an authorization error. The credentials that are provided during Virtual Machine configuration does not have permission to access the virtual machine.

Following is the screenshot of the page that is used to set the credentials while creating virtual machine. The issue was because the user 'prasath' does not below to 'MyAzureGroup' resource group and not granted any permission/role.

Create Virtual Machine

  1. To resolve this issue, from Azure portal home page, select the Resource Groups menu from the quick launch.
  2. Select the appropriate Resource Group
  3. Select Users from the settings panel
  4. Click Add from the Users panel
  5. Click Select a role from Add Access panel
  6. Select Owner from Select a role panel
  7. Select the user name to whom you want to grant permission to login to virtual machine and set them with appropriate role.

Permission Settings

After the above changes, recreated the virtual machine and the deployment when successfully without errors.

Tuesday, February 2, 2016

Develop SharePoint-hosted SharePoint Add-in to get user's permission at the site level

This article is a basic example of developing a SharePoint-hosted SharePoint Add-in and deploying to SharePoint online site

Source Code

Environment: Office 365, SharePoint Online, Visual Studio 2015, JSOM

Prerequisite: Active users are added to the Office 365 site and granted permission to access the SharePoint online.

Requirement: Develop a SharePoint-hosted SharePoint Add-in to get user's permission at the site level

Create the add-in project

  1. Start Visual Studio
  2. Choose File > New > New Project.
  3. In the New Project dialog box, expand the Visual C# node, expand the Office/SharePoint node, and then choose Add-ins > Add-in for SharePoint.
  4. Name the project, and then choose OK.

Create SharePoint Add-in using Visual Studio

  1. Specify the Add-in for SharePoint Settings dialog box, provide the full URL of the SharePoint site that you want to use to debug your add-in. This is the URL of the Developer Site. (Use HTTPS, not HTTP in the URL.) Under How do you want to host your SharePoint Add-in, choose SharePoint-hosted. Choose Finish.

Specify the SharePoint Add-in settings.

  1. Provide your subscription administrator's credential if prompted to login to your Developer Site.

Connect to SharePoint

  1. In Specify the target SharePoint version page, select SharePoint Online, and then click Finish button

Specify the target SharePoint version

Code your add-in

Following is the project items created by default template. Refer to this MSDN article for more information about each project item
Solution Explorer

Publish the Add-in

Publish the SharePoint Add-in

Deploy the Add-in to the developer site.

Deploy the SharePoint Add-in to the developer site

Developer Site home page with the Add-ins in Testing list

Developer Site home page with the Add-ins

Run the add-in

Note: User running this app should have appropriate permission to get the permission level for other users. A full control permission is recommended in this case.

Run the add-in

Source Code is available at TechNet gallery.