I'm using TFS (VS 2010) Build Definitions and XAMLs to build apps to different environments. Now, we need to push these builds to Production servers which require different credentials than what the Build Controller has.
I have been working on implementing the steps found at "Customize Team Build 2010 – Part 9: Impersonate activities (run under other credentials)" from http://www.ewaldhofman.nl/post/2010/05/28/Customize-Team-Build-2010-e28093-Part-9-Impersonate-activities-(run-under-other-credentials).aspx but I cannot figure out how to use the credentials within the XAML file.
So, I have implemented the provided solution, and have made build definitions require the credentials, but how do I implement the credentials code (which appears to be in C#) into the XAML (which is XML)?
Thanks,
Stephanie
I have solved my issue here. I wasn't aware that the activities were coded in C#, although organized through the XML.
You can use a TryCatch activity to wrap the impersonation object and dispose it in the Finally.
The XAML should look like:
<TryCatch>
<TryCatch.Variables>
<Variable x:TypeArguments="bl:Impersonation" Name="Impersonation" />
</TryCatch.Variables>
<TryCatch.Try>
<Sequence>
<mtbwa:WriteBuildMessage Message="Impersonating..." />
<ba:CreateImpersonationContext Credentials="[Credentials]" Result="[Impersonation]" />
<!-- Your activities go here -->
</Sequence>
</TryCatch.Try>
<TryCatch.Finally>
<Sequence>
<ba:DisposeImpersonationContext Impersonation="[Impersonation]" />
<mtbwa:WriteBuildMessage Message="Done with impersonation!" />
</Sequence>
</TryCatch.Finally>
</TryCatch>
Related
I am getting an error when I try to follow the steps to run PowerBI using the sample solution located in PowerBI-CSharp, when importing the PBIX Desktop file into my workspace on Azure (which is the second step and 6 item in the console provisioning app )
Error message does not say anything helpful: "Ooops, something broke: A task was canceled."
I tried with different PBIX files and even different workspaces in different times, no luck yet.
Currently I am using visual studio 2015 64 bit (planning to try with VS 2013 in near future).
I also had same issue.
I solved it by performing following steps:
1) creating simple .pbix file using Power BI desktop.
2) Save it on your harddisk
3) then try to upload it using console provisioning app.
Hope this will help!!
I received similar kind of error with a message "file not found".
The issue occurs when we do not write ".pbix" extention with the file name.
For example:
if your power bi file has name "myproject" then while writing the file name in the "File name" option give name with extension as "myproject.pbix".
I faced the same issue some time ago. Multiple things were going wrong.
First, the PBIX file I attempted to upload resided on a remote Hard Drive linked in my LAN network. The 'Getting-started' app did not have permissions to read the file.
I fixed this by copying the PBIX file to my personal desktop.
Second, make sure to fill in the correct data required before-hand in the program. Edit the file power-bi-embedded-integrate-report-into-web-app/ProvisionSample/App.config to save your personal settings. This will give fast reproduction of running the code.
<!-- The Power BI API Endpoint -->
<add key="powerBiApiEndpoint" value="https://api.powerbi.com" />
<!-- The Azure Resource Manager API Endpoint-->
<add key="azureApiEndpoint" value="https://management.azure.com" />
<!-- Your Azure subscription ID -->
<add key="subscriptionId" value="" />
<!-- The Azure resource group name -->
<add key="resourceGroup" value="" />
<!-- The Power BI Workspace Collection Name -->
<add key="workspaceCollectionName" value="" />
<!-- The Power BI Workspace Collection Access Key -->
<add key="accessKey" value="" />
<!-- The Power BI Workspace-->
<add key="workspaceId" value="" />
<!-- Credentials to connect to datasource within Power BI -->
<add key="username" value="" />
<add key="password" value="" />
Note the last two values username and password are not required for uploading a PBIX file. All other values subscriptionId, resourceGroup, workspaceCollectionName, accessKey and workspaceId are a must. All this information can be found on the Azure cloud in the PowerBI workspace collection tile.
Third, make sure the workspaceId you are uploading to does not already contain a PBIX file. As far as I am concerned, it is not possible to replace a PBIX file on a workspace and therefore a new workspace must be created to upload the PBIX file to. Please correct me if I am wrong.
No answer required - experience documented for others
I wasted significant time and hope to save others the trouble
TLDR;
If you are trying to use Microsoft Dynamics CRM with an ASP.NET 5 MVC 6 (dnx / vnext) application, don't overthink it - just use the existing web.config file!
Personally, I got so wrapped up in the new configuration paradigm that the now obvious approach of just using the good 'ol web.config file to store the required configuration settings did not occur to me.
I was trying to connect to Microsoft Dynamics CRM; everything compiled and executed until I hit code that tries to create a CRM context generated using CrmSvcUtil.exe.
var xrm = new XrmServiceContext("Xrm");
The runtime error I got was, "A configuration element with the name 'Xrm' under the 'contexts' collection does not exist."
This simply means that there is something wrong with the configuration file. Now, I had an existing console application with the proper (working) configuration settings and I was trying to simply port them over to this vNext solution:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="microsoft.xrm.client" type="Microsoft.Xrm.Client.Configuration.CrmSection, Microsoft.Xrm.Client"/>
</configSections>
<connectionStrings>
<add name="Xrm" connectionString="Server=https://myserver.crm.dynamics.com; Domain=; Username=myUsername#domain.com;Password=myPassword"/>
</connectionStrings>
<microsoft.xrm.client>
<contexts default="Xrm">
<add name="Xrm" type="Xrm.XrmServiceContext, Xrm" connectionStringName="Xrm"/>
</contexts>
</microsoft.xrm.client>
</configuration>
My mistake, however, was a misguided attempt to use the new configuration paradigm and import the "Microsoft.Framework.Configuration.Xml" NuGet package. Then, I added the configuration file containing the necessary settings during Startup(): Again, this isn't the right approach; use web.config instead:
var builder = new ConfigurationBuilder(env.WebRootPath)
.AddXmlFile("config.xml")
.AddEnvironmentVariables();
It took me writing out the speculation here that the CRM dll's have no clue about the new IConfigurationSource approach. I knew there had to be another way and then my Friday night tired brain finally clicked..."Hey, I see a web.config file...I wonder if that would work." Yes, it does.
I integrated active directory with sitecore and it works perfect, now i am trying to write patches for the config changes. Sections <membership defaultProvider="sitecore" hashAlgorithmType="SHA1"> and <roleManager defaultProvider="sitecore" enabled="true"> are changed for connection setting to AD. When i try to write config patch for this section, this section is not built at run time. But the domains section works, i mean the patch i created for this section works and writes to web.config at runtime. I observed a difference here Domains section is under <Sitecore>, <membership> and <roleManager > are in <system.web> section. Is this the reason that these are not included in web.config? can we write patches for those sections only under <sitecore>?
Any ideas are appreciated.
Thanks.
You can only patch elements within the /configuration/sitecore element.
Refer this post:
http://www.sitecore.net/Learn/Blogs/Technical-Blogs/John-West-Sitecore-Blog/Posts/2011/05/All-About-Web-config-Include-Files-with-the-Sitecore-ASPNET-CMS.aspx
I think you have to use config transforms as mentioned by leandro.
I assumming you are using Visual Studio ¿? You must specify in what are you working.
If so, you need create a transform file for the build configuration that you need, for example, one config for every environment or publish type.
Try a look at this:
http://msdn.microsoft.com/en-us/library/vstudio/dd465318%28v=vs.100%29.aspx
I have implemented creation of subcommunities using IBM SBT 1.0.2.20140527-1807 against IC 4.5 (thanks for heavy API changes from 1.0.1 :-/ ) and want to update a freshly created subcommunity with a nice "content" containing some HTML with links to some content inside this community. Thus I must first create the subcommunity and afterwards update the "content" attribute, because I need some data not yet present before successful creation.
The way I do this is basically as follows:
(1) Create subcommunity [proven successful, and it IS a subcommunity now]
(2) Fetch the new subcommunity using CommunityService.getCommunity(communityUuid) [proven successful]
(3) execute community.setContent(string) [no errors]
(4) execute CommunityService.updateCommunity(community) [no errors]
The REST request created and sent for CREATE is:
POST /communities/service/atom/community/subcommunities?communityUuid=8ea4ff45-ef58-4c9b-b131-def2d3e233f7
The XML data sent is:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">mytitle</title>
<content type="html">mycontent</content>
<category term="community" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<category term="mytag"></category>
<snx:communityType xmlns:snx="http://www.ibm.com/xmlns/prod/sn">private</snx:communityType>
</entry>
The REST request created and sent for UPDATE is:
PUT /communities/service/atom/community/instance?communityUuid=ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7
The XML data sent is:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">mytitle</title>
<content type="html">mycontent</content>
<category term="community" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<category term="mytag"></category>
<snx:communityType xmlns:snx="http://www.ibm.com/xmlns/prod/sn">private</snx:communityType>
<snx:communityUuid xmlns:snx="http://www.ibm.com/xmlns/prod/sn">ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7</snx:communityUuid>
<id>http://communities.ibm.com:2006/service/atom/community/instance?communityUuid=ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7</id>
</entry>
Afterwards the content is indeed updated -- but the community is not a subcommunity any more, but a regular top level community.
Why is that?
What can I do about it?
For the impatient: I have found the root cause, and in some circumstances this offers the possibility for a workaround.
The root cause is that the Community representation in IBM SBT SDK (Java) currently (as of July 2014) does not offer a "parent community URL" element.
http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+API+Documentation#action=openDocument&res_title=Community_entry_content_ic45&content=pdcontent says that a community XML representation has a <link rel="http://www.ibm.com/xmlns/prod/sn/parentcommunity" type="application/atom+xml" href="..." /> element (where href is the atom/instance URL, not the "community URL" with html/communityview) if it represents a subcommunity, which is ignored on PUT/POST -- but:
THIS IS NOT TRUE:
In fact this element is REQUIRED on PUT to keep a community's "sub community" nature on change. And worse: If it is broken, it cannot be "repaired": Because of other limitations for subcommunities, an existing community cannot be changed to become a subcommunity of another top level community. Subcommunities can only be CREATED (and kept, of course).
What I have done to work around that pitfall is to subclass Community and some other classes to extend the XML marshal/unmarshal mechanisms in SBT SDK to cope with parent community URLs. If you know what you're doing everything is fine, but if you want generic code which simply does not break subcommunities, you must also READ ALL COMMUNITIES as if they may be subcommunities. If you don't, you won't see this information and write back the community as top level community.
Thus it is better to wait if you can :-(
I expect IBM to extend the implementation of Community and related classes by a parent community URL field. What I am curious about is how they will deal with the fact that the complete Atom feed URL is required, including the server address and the parent community UUID. I took the q&d way and changed the community URL as returned by parentCommunity.getCommunityUrl(), but this eventually does not take into account the various AUTH variants.
IBM SBT SDK 1.1.0 of Jul 17, 2014, seems to be out. At least it is available in Maven central.
This is the better answer of course but will require several code adjustments if you have built code on top of internal structures due to some internal refactorings.
How to debug the J2ME Polish MIDlet?
How can I show the logs which are generated?
You can easly log statements with J2ME Polish using the following:
//#debug
System.out.println("Error...");
Using //#debug with J2ME Polish indicates a pre-processing directive to log the println statement.
There are various levels of logging, including debug, info, warn, error and fatal. You can define your own logging levels but I find that over exhaustive for most situtations.
The best thing I found was to add a handler to the build file within the debug section.
<handler name="http">
<parameter name="server" value="http://a.server.com:80/Debug/" />
</handler>
Will post any log information straight to a server, so you can literally see the log flow in as your application is running.
Or you can add a handler that logs to an RMS and use the J2ME Polish Logviewer sample application to view the logs stored within the RMS. The can be found in the sample directory of your J2ME Polish installation.
<handler name="rms">
<parameter name="useBackgroundThread" value="false" />
</handler>
Remember to set the varriables in the logview build file. See below:
<variables>
<variable name="polish.log.MIDletSuite" value="Demonstrator" />
<variable name="polish.log.Vendor" value="Enough Software" />
</variables>
I had a collegue at work try to debug via bluetooth but I think this doesn't actually work.
Just a note to any one reading this who is new J2ME, you cannot debug on device! MIDlets and J2ME were first concieved in the late 90's.