1. Double click your image at the top right of the CRM 2016 screen.
2. Select Choose File
3. Pick your picture and click open
4. Click OK
Your profile picture should now be updated!
PS> $objUser = New-Object System.Security.Principal.NTAccount("{domain name}")With the returned SID I could identify the record
PS> $strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier])
PS> $strSID.Value
S-1-5-21-1004336348-1715567821-725345543-40705
SELECT * FROM SystemUserAuthentication WHERE AuthInfo LIKE '%S-1-5-21-1004336348-1715567821-725345543-40705'I decided to update the record SID to one that will never exist rather than delete, as there could be a spider web of relationships that get really stuffed up.
UPDATE SystemUserAuthentication
SET AuthInfo = 'W:S-1-5-21-1004336348-1715567822-725345543-40705'
WHERE Id = 'CF775160-6BE6-E511-80CF-005056BD0631'After this update I was able to create the user record.
exec sp_executesql N'declare @currentval intupdate OrganizationBase set @currentval = CurrentBulkOperationNumber, CurrentBulkOperationNumber = CurrentBulkOperationNumber + 1 where OrganizationId = @orgidselect @currentval',N'@orgid uniqueidentifier',@orgid='E14513F2-5CDB-4194-9CA1-52D04CD0B077'
UPDATE OrganizationBase SET CurrentBulkOperationNumber = 1000
SELECT db.* INTO DependencyBase_backup FROM DependencyBase dbJOIN DependencyNodeBase dnb ON dnb.DependencyNodeId = db.DependentComponentNodeIdJOIN ReportEntity rpe ON rpe.ReportEntityId = dnb.ObjectIdWHERE ComponentType = 32 and rpe.ObjectTypeCode = 10001SELECT dnb.* INTO DependencyNodeBase_backup FROM DependencyNodeBase dnbJOIN ReportEntity rpe ON dnb.ObjectId = rpe.ReportEntityIdWHERE ComponentType = 32 and rpe.ObjectTypeCode = 10001SELECT * INTO ReportEntityBase_backup FROM ReportEntityBase WHERE ObjectTypeCode = 10001
DELETE db FROM DependencyBase db
JOIN DependencyNodeBase dnb ON dnb.DependencyNodeId = db.DependentComponentNodeId
JOIN ReportEntity rpe ON rpe.ReportEntityId = dnb.ObjectId
WHERE ComponentType = 32 and rpe.ObjectTypeCode = 10001
DELETE dnb FROM DependencyNodeBase dnb
JOIN ReportEntity rpe ON dnb.ObjectId = rpe.ReportEntityId
WHERE ComponentType = 32 and rpe.ObjectTypeCode = 10001Delete the Orphaned records
DELETE FROM ReportEntityBase WHERE ObjectTypeCode = 10001
private static IOrganizationService GetHttpsCRMService(string serverUrl, string adfsUrl, string username, string password){Uri organizationUriIFD = new Uri(serverUrl + "/XRMServices/2011/Organization.svc");EndpointAddress endpointAddress = new EndpointAddress(organizationUriIFD);CustomBinding customBinding = new CustomBinding();customBinding.Name = "CustomBinding";var tsBE = new TransportSecurityBindingElement();tsBE.AllowInsecureTransport = false;tsBE.IncludeTimestamp = true;EndpointAddress usernameMixed = new EndpointAddress(adfsUrl + "/adfs/services/trust/13/usernamemixed");WS2007HttpBinding wsbinding = new WS2007HttpBinding(SecurityMode.TransportWithMessageCredential);wsbinding.MaxReceivedMessageSize = 65536;wsbinding.MaxBufferPoolSize = 524288;wsbinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;wsbinding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;wsbinding.Security.Message.EstablishSecurityContext = false;IssuedSecurityTokenParameters stP = new IssuedSecurityTokenParameters(null, usernameMixed, wsbinding);stP.IssuerMetadataAddress = new EndpointAddress(new Uri(adfsUrl + "/adfs/services/trust/mex"));var additionalRquestParameters =@"<trust:SecondaryParameters xmlns:trust='http://docs.oasis-open.org/ws-sx/ws-trust/200512'>" +@" <trust:KeyType xmlns:trust='http://docs.oasis-open.org/ws-sx/ws-trust/200512'>http://docs.oasis-open.org/ws-sx/ws-trust/200512/SymmetricKey</trust:KeyType>" +@" <trust:KeySize xmlns:trust='http://docs.oasis-open.org/ws-sx/ws-trust/200512'>256</trust:KeySize>" +@" <trust:Claims Dialect='http://schemas.xmlsoap.org/ws/2005/05/identity' xmlns:trust='http://docs.oasis-open.org/ws-sx/ws-trust/200512'>" +@" <wsid:ClaimType Uri='http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn' xmlns:wsid='http://schemas.xmlsoap.org/ws/2005/05/identity' />" +@" </trust:Claims>" +@" <trust:KeyWrapAlgorithm xmlns:trust='http://docs.oasis-open.org/ws-sx/ws-trust/200512'>http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p</trust:KeyWrapAlgorithm>" +@" <trust:EncryptWith xmlns:trust='http://docs.oasis-open.org/ws-sx/ws-trust/200512'>http://www.w3.org/2001/04/xmlenc#aes256-cbc</trust:EncryptWith>" +@" <trust:SignWith xmlns:trust='http://docs.oasis-open.org/ws-sx/ws-trust/200512'>http://www.w3.org/2000/09/xmldsig#hmac-sha1</trust:SignWith>" +@" <trust:CanonicalizationAlgorithm xmlns:trust='http://docs.oasis-open.org/ws-sx/ws-trust/200512'>http://www.w3.org/2001/10/xml-exc-c14n#</trust:CanonicalizationAlgorithm>" +@" <trust:EncryptionAlgorithm xmlns:trust='http://docs.oasis-open.org/ws-sx/ws-trust/200512'>http://www.w3.org/2001/04/xmlenc#aes256-cbc</trust:EncryptionAlgorithm>" +@"</trust:SecondaryParameters>";System.Xml.XmlDocument additionalParamDoc = new System.Xml.XmlDocument();additionalParamDoc.LoadXml(additionalRquestParameters);stP.AdditionalRequestParameters.Add(additionalParamDoc.DocumentElement);stP.RequireDerivedKeys = false;stP.KeySize = 256;stP.KeyType = System.IdentityModel.Tokens.SecurityKeyType.SymmetricKey;tsBE.LocalClientSettings.DetectReplays = false;tsBE.LocalServiceSettings.DetectReplays = false;tsBE.EndpointSupportingTokenParameters.Endorsing.Add(stP);customBinding.Elements.Add(tsBE);var textEncoding = new System.ServiceModel.Channels.TextMessageEncodingBindingElement();var httpsTransport = new System.ServiceModel.Channels.HttpsTransportBindingElement();customBinding.Elements.Add(textEncoding);customBinding.Elements.Add(httpsTransport);customBinding.ReceiveTimeout = new TimeSpan(0, 10, 0);customBinding.SendTimeout = new TimeSpan(0, 1, 0);customBinding.OpenTimeout = new TimeSpan(0, 1, 0);customBinding.CloseTimeout = new TimeSpan(0, 1, 0);var contract = new System.ServiceModel.Description.ContractDescription("IOraganizationService", "http://schemas.microsoft.com/xrm/2011/Contracts/Services");contract.ContractType = typeof(IOrganizationService);OrganizationServiceClient osClient = new OrganizationServiceClient(customBinding, endpointAddress);osClient.ClientCredentials.UserName.UserName = username;osClient.ClientCredentials.UserName.Password = password;return (IOrganizationService)osClient;}